Skip to content

Instantly share code, notes, and snippets.

@shurane
Created November 4, 2014 18:55
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 shurane/c76a723d80153eb66249 to your computer and use it in GitHub Desktop.
Save shurane/c76a723d80153eb66249 to your computer and use it in GitHub Desktop.
HTTP debugging. Kind of nifty.
var express = require('express');
var chalk = require('chalk');
var app = express();
app.all('*', function (req, res) {
console.log(chalk.blue('===========' + new Date()));
console.log('req.method', req.method);
console.log('req.url', req.url);
console.log('req.path', req.path);
console.log('req.headers', req.headers);
console.log('req.params', req.params);
console.log('req.query', req.query);
console.log('req.body', req.body);
res.send('{}');
});
var server = app.listen(5001, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment