I'm building express web app in which I want to manage user permission to certain page based on JWT . For that I'm using express-jwt middleware to add token to the request url before the request is handled by server. In client side(pug) I'm requesting the page by 'href'.
a(href='/reqpage')
router to the controller :
const auth = jwt({
secret:process.env.JWT_SECRET,
algorithms:['sha512'],
userProperty : 'payload'
})
router.route('/reqpage').get(auth, ctrlMain.reqpage);
Here how can I add token to the request header in client side, so that the middleware attach it to the request to controller.