Middleware are functions that can be used for handling request and response objects.
In practice, you can use several middlewares at the same time. When you have more than one, they're executed one by one in the order that they were taken into use in the express.
In practice, you can use several middleware at the same time. When you have more than one, they're executed one by one in the order that they were taken into use in express.
Middleware is a function that receives three parameters:
const requestLogger = (request, response, next) => {
console.log('Method:', request.method)
console.log('Path: ', request.path)
console.log('Body: ', request.body)
console.log('---')
next()
}
No comments:
Post a Comment