Reputation: 1
I want to generate token in nodejs where i can authenticate the user.
const expressjwt = require('express-jwt');
function authJwt() {
const secret = process.env.secret;
return expressjwt({ secret, algorithms: ['HS256'] });
}
module.exports = authJwt;
server.js file:
const authJwt = require('./helpers/jwt');
app.use(authJwt);
I have tried to call authJwt() as well but its not working. Is there any solution or am i doing anything wrong? I am getting this error "TypeError: expressjwt is not a function".
Upvotes: 0
Views: 22