当前位置:网站首页>使用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官网
边栏推荐
- 4.2 声明式事务概念
- MySQL数据库面试题总结(2022最新版)
- webrtc中的视频编码(一) 视频编码模块轮廓
- 4.1 JdbcTemplate for declarative transactions
- 去重的几种方式
- SLSA 框架与软件供应链安全防护
- EventBus源码分析
- C language -- operator details
- npm报错Beginning October 4, 2021, all connections to the npm registry - including for package installa
- EntityComponentSystemSamples学习笔记
猜你喜欢

腾讯136道高级岗面试题:多线程+算法+Redis+JVM

The difference between px, em, and rem

代码重构:面向单元测试

Resolved error: npm WARN config global `--global`, `--local` are deprecated

Grain Mall - Basics (Project Introduction & Project Construction)

webrtc中视频采集实现分析(二) 视频帧的分发
![Embedded system driver primary [4] - under the basis of character device driver _ concurrency control](/img/96/5224d2de152eb738703cd201fb8407.png)
Embedded system driver primary [4] - under the basis of character device driver _ concurrency control

SLSA 框架与软件供应链安全防护

Swoole学习(一)

7.16 Day22---MYSQL(Dao模式封装JDBC)
随机推荐
擎朗智能全国研发创新中心落地光谷:去年曾获2亿美元融资
OpenCV获取和设置图像的平均亮度
4.3 基于注解的声明式事务和基于XML的声明式事务
注意!软件供应链安全挑战持续升级
CentOS7 —— yum安装mysql
As soon as flink cdc is started, the CPU of the source Oracle server soars to more than 80%. What is the reason?
4.2 Declarative Transaction Concept
音视频相关基础知识与FFmpeg介绍
Typora 使用保姆级教程 | 看这一篇就够了 | 历史版本已被禁用
Can 't connect to MySQL server on' localhost3306 '(10061) simple solutions
npm报错Beginning October 4, 2021, all connections to the npm registry - including for package installa
【JS】js给对象动态添加、设置、删除属性名和属性值
通过&修改数组中的值
Dynamic programming of the division of numbers
8.03 Day34---BaseMapper查询语句用法
sql server如何得到本条记录与上一条记录的差异,即变动值
7.18 Day23 - the markup language
Swoole学习(一)
Do you think border-radius is just rounded corners?【Various angles】
Grain Mall - Basics (Project Introduction & Project Construction)