Skip to content

Instantly share code, notes, and snippets.

@blockjon
Created August 19, 2012 06:29
Show Gist options
  • Save blockjon/3392706 to your computer and use it in GitHub Desktop.
Save blockjon/3392706 to your computer and use it in GitHub Desktop.
var express = require('express');
var NotifyClass = require('./NotifyService').NotifyService;
var notifyService = new NotifyClass();
var app = express();
app.use(express.bodyParser());
// all environments
app.set('views', __dirname + '/views');
app.engine('html', require('ejs').renderFile);
app.get('/', function(req, res){
var channel = notifyService.createChannel();
res.send('curl -H "Content-type: application/json" --data "{\\"key\\" : \\"' + channel.uuid + '\\", \\"description\\" : \\"hello world\\"}" http://127.0.0.1/notify\n\
Send users to: http://127.0.0.1/launch/' + channel.channelKey + '\n\
');
});
app.post('/notify', function(req, res) {
res.send("ok");
notifyService.ingest(req.body);
});
app.get('/launch/:key', function(req, res) {
res.render('launch');
});
app.listen(80);
console.log('Listening on port 80');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment