I'm working on Nodejs and using "Express js" and now I'm working on "Middleware Functions" and this is my current code
const express = require('express') const app = express() const myLogger = function (req, res, next) { console.log('LOGGED') next() } app.use(myLogger) app.get('/', (req, res) => { res.send('Hello World!') })
I'm confused about the "next" parameter and I have the following questions about the middleware function
2) Your request will reach the route handler and you will receive a response containing the message "Hello World"
3) If you do not call next, the request will be terminated and the application will remain suspended
4) Yes, you can use next to redirect to a custom middleware function. Whenever next is called with arguments, expresss will treat it as an error message. You can define custom error handling middleware to direct it according to your needs.