NestJS - Middleware
Identify the error in this functional middleware code:
function check(req, res, next) {
if (!req.user) {
res.status(401).send('Unauthorized');
}
next();
}