Complete the code to add a middleware function that logs every request.
app.use(function(req, res, next) { console.log(req.[1]); next(); });The middleware logs the URL of each request using req.url.
Complete the code to create middleware that ends the response with 'Hello World'.
app.use(function(req, res, [1]) { res.send('Hello World'); });
The middleware function uses next as the third parameter to pass control if needed.
Fix the error in the middleware that should call the next function.
app.use(function(req, res, next) { console.log('Request received'); [1](); });The middleware must call next() to pass control to the next middleware.
Fill both blanks to create middleware that checks if user is authenticated and calls next if true.
app.use(function(req, res, next) { if (req.[1]) { [2](); } else { res.status(401).send('Unauthorized'); } });The middleware checks req.isAuthenticated and calls next() if true.
Fill all three blanks to create middleware that logs method, URL, and then calls next.
app.use(function(req, res, next) { console.log(req.[1] + ' ' + req.[2]); [3](); });The middleware logs the HTTP method and URL, then calls next() to continue.