0

I am learning to use middlewares and as I am trying to import express-jwt it does not work. I am using the following syntax: const expressJwt = require('express-jwt')

I uninstalled express-jwt and installed an older version [email protected], in which it works, but I wanna know how to fix it on the new version.

1

2 Answers 2

1

Try this:

const { expressjwt } = require("express-jwt"); 

Official docs

Sign up to request clarification or add additional context in comments.

Comments

0
//protection API and Authentication JWT middleware const expressJwt = require('express-jwt') function authJwt() { const secret = process.env.secret; function expressJwt(param) { return undefined; } have the same problem return expressJwt({ secret, algorithms: ['HS256'] }) } module.exports = authJwt; 

enter image description here

1 Comment

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.