This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.post('/userInfo', function(req, res){ // Route for handling the request | |
jwt.verify(req.body.token, JWT_SECRET, (err, decoded) => { // Checking if the JWT token of the user is valid | |
if (err){ // Handling error | |
res.json({ | |
"info" : "Error0" | |
}); | |
}else{ | |
if(typeof decoded.username === "undefined"){ // Checking if username is defined in the request | |
res.json({ // Handling the error | |
"info" : "Error1" |