I implemented JWT token authentication using node.js and MongoDB. It's working fine. Throwing error messages is also working fine (token invalid, JWT expired, JWT must be provided). But how do I get the appropriate HTTP status code in the error message automatically?
// jwt.js
function Verify_Token(accessToken) {
jwt.verify(accessToken, config.get("jwtprivatekey"), function (err) {
value = err
});
return value
}