Created
November 4, 2014 18:55
-
-
Save shurane/c76a723d80153eb66249 to your computer and use it in GitHub Desktop.
HTTP debugging. Kind of nifty.
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 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