Well, my question is I want to pass some variable from the first middleware to another middleware, and I tried doing this, but there was "req.somevariable
is a given as 'undefined'".
//app.js
..
app.get('/someurl/', middleware1, middleware2)
...
////middleware1
...
some conditions
...
res.somevariable = variable1;
next();
...
////middleware2
...
some conditions
...
variable = req.somevariable;
...
res
in middleware1 and try to get it fromreq
in middleware2. – Andreas HultgrenLocal variables are available in middleware via req.app.locals
expressjs.com/pt-br/api.html#app.locals – Ronnie Royston