【发布时间】:2022-01-20 10:14:11
【问题描述】:
当我的程序这样时,以前的中间件可以向 Postman 发送字符串 'Hello world'。
app.use((req, res, next) => {
console.log(req.body);
res.send('Hello world');
next();
})
app.use(express.json());
})
但我不知道为什么当我将测试中间件放在 app.use(express.json()) 之后时,它什么都不发送。我使用邮递员发送带有 json 类型原始数据的 post 请求。
【问题讨论】:
标签: json api express postman middleware