Skip to content

Instantly share code, notes, and snippets.

@bharathvaj-ganesan
Created July 29, 2018 15:11
Show Gist options
  • Save bharathvaj-ganesan/4c72bd8741e99f063fcf467995cd6599 to your computer and use it in GitHub Desktop.
Save bharathvaj-ganesan/4c72bd8741e99f063fcf467995cd6599 to your computer and use it in GitHub Desktop.
const express = require('express');
const events = require('./events');
const path = require('path');
const app = express();
const port = process.env.PORT || 5001;
const expressWs = require('express-ws')(app);
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/static/index.html'));
});
app.ws('/', function(ws, req) {
const githubEvent = {}; // sample github Event from Github event API https://api.github.com/events
ws.send('message', githubEvent);
});
app.listen(port, function() {
console.log('Listening on', port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment