Last active
April 25, 2017 18:04
-
-
Save jondlm/d7442c115b496d7e10ad3f3786435604 to your computer and use it in GitHub Desktop.
A little node server that logs the most recent request and response headers
This file contains hidden or 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
const express = require('express') | |
const app = express() | |
const util = require('util') | |
app.get('*', function (req, res) { | |
process.stdout.write('\033c') | |
console.log('Request headers:') | |
console.log(util.inspect(req.headers, { colors: true })) | |
res.send('test') | |
console.log('\nResponse headers:') | |
console.log(util.inspect(res.header()._headers, { colors: true })) | |
}) | |
app.listen(9876, function () { | |
console.log('Listening on port 9876') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment