Im using Node and Express for a API REST. Is it possible to add a condition IF statemtent in the router? Just like this:
.route('/app')
.post(
openPool
, checkToken
, checkCondition //set req.condition = true
(req, res, next) => {
if (req.condition === true){
Controller1
, Controller2
}
next()
}
, sendResponse
);
It doesnt throw any error, it just doesnt execute the code of Controller1 and Controller2