Skip to content

Instantly share code, notes, and snippets.

@ayushgp
Created November 9, 2016 05:20
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 ayushgp/988e5d182cf6f4e71575e1888544472c to your computer and use it in GitHub Desktop.
Save ayushgp/988e5d182cf6f4e71575e1888544472c to your computer and use it in GitHub Desktop.
function logHeaders(req, res, next){
console.log(req.headers);
next();
}
function logURL(req, res, next){
console.log(req.url);
next();
}
// Pass middleware functions just like we did in app.use
app.get('/', logHeaders, logURL, function(req, res){
res.send("Headers and URL for this request are logged.");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment