【express】use中间件回调函数参数个数踩坑记录
在express的错误处理,使用以下代码
import { Request, Response, NextFunction } from 'express';
import createError from 'http-errors';
// ...
app.use((req: Request, res: Response, next: NextFunction) => {
next(new createError.NotFound());
});
app.use((err: any, re
原创
2022-02-16 14:29:18 ·
486 阅读 ·
0 评论