Skip to content

Instantly share code, notes, and snippets.

@jondlm
Last active April 25, 2017 18: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 jondlm/d7442c115b496d7e10ad3f3786435604 to your computer and use it in GitHub Desktop.
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
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