Last active
August 29, 2015 14:04
-
-
Save mlconnor/9d497818ba117b0805ad to your computer and use it in GitHub Desktop.
This fill will dump raw post data to the console. An enhancement would be to use middleware to grab all posts.
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') | |
, http = require('http') | |
, bodyParser = require('body-parser') | |
, _ = require('underscore') | |
, cookieParser = require('cookie-parser'); | |
var app = express(); | |
/* configure express */ | |
app.set('port', process.env.PORT || 3000); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded()); | |
app.use(cookieParser()); | |
app.use(function(req,res,next) { | |
console.log("Request", _.pick(req, 'headers', 'method', 'url', 'query', 'body')); | |
res.send("ok"); | |
next(); | |
}); | |
http.createServer(app).listen(app.get('port'), function() { | |
console.log("MLC iExpress server listening on port " + app.get('port')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment