Created
July 29, 2018 15:11
-
-
Save bharathvaj-ganesan/4c72bd8741e99f063fcf467995cd6599 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
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