当前位置:网站首页>使用express-jwt第三方包报错TypeError: expressJWT is not a function
使用express-jwt第三方包报错TypeError: expressJWT is not a function
2022-08-04 05:26:00 【strongest强】
原因:你很有可能是安装了最新版本的express-jwt包,但是你使用的是第六版的语法
//第六版语法
const expressJWT = require("express-jwt");
const secretKey = "strongest ^0^";
app.use(
expressJWT({
secret: secretKey, algorithms: ["HS256"] })
);
//结果:express().use(expressJWT({ secret: secretKey, algorithms: ["HS256"] }));
//TypeError: expressJWT is not a function
解决方案
//最新语法
var {
expressjwt: expressJWT} = require("express-jwt");
const secretKey = "strongest ^0^";
app.use(
expressJWT({
secret: secretKey, algorithms: ["HS256"] })
);
express-jwt包更多详细内容,请看express-jwt官网
边栏推荐
- 【问题解决】同一机器上Flask部署TensorRT报错记录
- Canal mysql data synchronization
- Sublime Text 3 2021.8.3 个人配置
- 程序员也应了解的Unity粒子系统
- 4.2 Declarative Transaction Concept
- Oracle备份脚本
- Deploy LVS-DR cluster [experimental]
- Cannot read properties of null (reading ‘insertBefore‘)
- 在被面试官说了无数次后,终于潜下心来整理了一下JVM的类加载器
- 显式调用类的构造函数(而不是用赋值构造),实现一个new操作
猜你喜欢

心余力绌:企业面临的软件供应链安全困境

webrtc中的任务队列TaskQueue

C1认证之web基础知识及习题——我的学习笔记

FPGA学习笔记——知识点总结

Code Refactoring: For Unit Testing

Cannot read properties of null (reading ‘insertBefore‘)

8. Custom mapping resultMap

8.03 Day34---BaseMapper query statement usage
![Embedded system driver primary [3] - _IO model in character device driver foundation](/img/c7/21fc0651964a6a435e8ec5743b7662.png)
Embedded system driver primary [3] - _IO model in character device driver foundation

【论文阅读笔记】无监督行人重识别中的采样策略
随机推荐
Unity开发类似Profile那样的数据分析工具
Summary of MySQL database interview questions (2022 latest version)
MediaCodec支持的类型
力扣:62.不同路径
php实现telnet访问端口
The symbol table
Code Refactoring: For Unit Testing
Oracle备份脚本
文献管理工具 | Zotero
Embedded system driver primary [3] - _IO model in character device driver foundation
7、特殊SQL的执行
OpenRefine中的正则表达式
Unity表格配置编辑工具
12. Paging plugin
手把手教你实现buffer(二)——内存管理及移动语义
梳理CamStyle、PTGAN、SPGAN、StarGAN
C language -- operator details
webrtc中视频采集实现分析(一) 采集及图像处理接口封装
如何将 DevSecOps 引入企业?
显式调用类的构造函数(而不是用赋值构造),实现一个new操作