当前位置:网站首页>使用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官网
边栏推荐
猜你喜欢
The idea setting recognizes the .sql file type and other file types
7.18 Day23 - the markup language
想好了吗?
程序员也应了解的Unity粒子系统
EntityComponentSystemSamples学习笔记
8.03 Day34---BaseMapper查询语句用法
【论文阅读笔记】无监督行人重识别中的采样策略
word 公式编辑器 键入技巧 | 写数学作业必备速查表
Delphi-C端有趣的菜单操作界面设计
Do you think border-radius is just rounded corners?【Various angles】
随机推荐
Cannot read properties of null (reading ‘insertBefore‘)
Delphi-C端有趣的菜单操作界面设计
嵌入式系统驱动初级【4】——字符设备驱动基础下_并发控制
想低成本保障软件安全?5大安全任务值得考虑
去重的几种方式
7.13 Day20----MYSQL
8.03 Day34---BaseMapper查询语句用法
动态规划总括
8、自定义映射resultMap
webrtc中的视频编码(一) 视频编码模块轮廓
EntityComponentSystemSamples学习笔记
Unity开发类似Profile那样的数据分析工具
OpenRefine开源数据清洗软件的GREL语言
在被面试官说了无数次后,终于潜下心来整理了一下JVM的类加载器
webrtc中视频采集实现分析(一) 采集及图像处理接口封装
Redis common interview questions
JS基础--强制类型转换(易错点,自用)
TensorRT例程解读之语义分割demo
The idea setting recognizes the .sql file type and other file types
EventBus源码分析