Skip to content

Instantly share code, notes, and snippets.

@bigslycat
Created December 18, 2016 23:30
Show Gist options
  • Select an option

  • Save bigslycat/3f82f8802fcdc5a3e070c12534f49f8a to your computer and use it in GitHub Desktop.

Select an option

Save bigslycat/3f82f8802fcdc5a3e070c12534f49f8a to your computer and use it in GitHub Desktop.
'use strict';
import http from 'http';
import express from 'express';
import Bluebird from 'bluebird';
import socketIo from 'socket.io';
import { PORT } from '../config/env';
global.Promise = Bluebird;
const app = express();
export const server = new http.Server(app);
const io = socketIo(server);
const onAction = (data) => {
console.log(data);
};
const onSocketConnect = (socket) => {
console.log('connect');
socket.on('action', onAction);
};
app.use(express.static('build'));
app.listen(PORT, () => {
console.log(PORT);
});
io.on('connection', onSocketConnect);
export default app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment