This function is always returning true when trying to authenticate the user:
exports.IsUser = function(req, res, next) {
    if (req.user.role === "user") {
        next();
    } else {
       return res.status(401).json({ message: 'Unauthorized user!' });
    }
};
The json req.user:
{
    "email": "test@gmail.com",
    "fullName": "testname",
    "role": "user",
    "iat": 1502495033
}
the routing function:
app.route('/')
    .get(function(req, res, next) {
    res.json(req.user);})
    .post(control.IsUser);
 
    