Skip to content

Instantly share code, notes, and snippets.

@mlconnor
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlconnor/9d497818ba117b0805ad to your computer and use it in GitHub Desktop.
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.
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