Middleware functions are functions that have access to the request object (req), the response object (res), and the next middleware function in the application’s request-response cycle.
Example:
const logger = (req,res,next) => {
//whatever piece of code written here can be accessed by other functions
//always the next function has to be called
next()
}
Top comments (0)