Skip to content

Instantly share code, notes, and snippets.

@maxmckenzie
Last active July 29, 2019 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxmckenzie/a67197860fbc2e40bd2a8e52b4bebbea to your computer and use it in GitHub Desktop.
Save maxmckenzie/a67197860fbc2e40bd2a8e52b4bebbea to your computer and use it in GitHub Desktop.
basic bare minimum express server #express
import express from 'express';
import http from 'http'
/**
* Express Set Up
*/
const app = express()
app.set('view engine', 'pug')
app.use('/assets', express.static('assets'));
const server = http.createServer(app);
const io = require('socket.io').listen(server);
server.listen(5050);
io.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment