Skip to content

Instantly share code, notes, and snippets.

@ayushgp
Created November 9, 2016 04:32
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/7c21ff7a602d477e7f12e8ff06597f59 to your computer and use it in GitHub Desktop.
Save ayushgp/7c21ff7a602d477e7f12e8ff06597f59 to your computer and use it in GitHub Desktop.
var app = require('express')();
function logger(req, res, next){
console.log("A %s request was received at %s", req.method, req.url);
next();
}
// Use the middleware function
app.use(logger);
app.get('/', function(req, res){
res.send("Hello World!");
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment