Created
December 18, 2016 23:30
-
-
Save bigslycat/3f82f8802fcdc5a3e070c12534f49f8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '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