var express = require("express"); var fs = require("fs"); var bodyParser = require("body-parser"); var app = express(); var logfile = fs.createWriteStream('./log.log', {flags: 'a'}); app.use(bodyParser.json()); app.get('/', function(req, res){ //res.sendFile("/usr/src/app/index.html"); fs.createReadStream('./log.log').pipe(res); console.log("got a GET request..."); }); app.post('/', function(req, res){ var postEvent = req.body.postEvent; var source = req.body.source; console.log("Post event = "+postEvent+", source is "+source); console.log(req.body); //res.send(JSON.stringify(req.body, null, 4)); }); app.listen(3000, function() { console.log("Started on PORT 3000"); })