【发布时间】:2020-09-16 02:37:52
【问题描述】:
目前我有两个文件:
service.js
const routes = (app) => {
app.route('/produce')
.get((req, res) => res.send(`GET Method from /produce`))
.post((req, res) => res.send(req.body))
};
module.exports = routes;
app.js
const service = require('./service.js');
service(app);
之后,当我尝试“GET”时,它会按预期返回文本“GET Method from /produce”
但是,当我尝试“发布”某些消息时,它无法返回我的请求消息。
有人可以帮忙吗?非常感谢。
【问题讨论】:
-
POST 动作的响应是什么?是 404 错误还是 200 出现意外消息?