Skip to content

Instantly share code, notes, and snippets.

@ayushgp
Created November 9, 2016 05:00
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/4e6748e5edc6b97d041c066dadc9e066 to your computer and use it in GitHub Desktop.
Save ayushgp/4e6748e5edc6b97d041c066dadc9e066 to your computer and use it in GitHub Desktop.
// First middleware
app.use(function(req, res, next){
console.log("Started");
next();
});
// Route handler
app.get('/', function(req, res, next){
res.send("Sent to client");
next();
});
// Last middleware
app.use('/', function(req, res){
console.log("Ended");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment