Created
June 7, 2018 23:27
-
-
Save justlaputa/05d71ac44f91c9c407c2da3f8d35a2db to your computer and use it in GitHub Desktop.
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
var app = express() | |
var bodyParser = require('body-parser') | |
// third party middleware | |
// parse application/json | |
app.use(bodyParser.json()) | |
// user defined middleware | |
app.use(function (req, res, next) { | |
console.log('Time:', Date.now()) | |
next() | |
}) | |
// use middleware for specific url path | |
app.use('/user/:id', function (req, res, next) { | |
checkUser(req.params.id) | |
next() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment