Created
August 19, 2012 06:29
-
-
Save blockjon/3392706 to your computer and use it in GitHub Desktop.
This file contains 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
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