如何解决服务器响应状态为 404未找到问题
我的项目遇到了 404 问题。
val swipePath = Path()
swipePath.moveto(1000f,1000f)
swipePath.lineto(100f,1000f)
swipePath.lineto(400f,1000f)
val gestureBuilder = GestureDescription.Builder()
gestureBuilder.addstroke(strokeDescription(swipePath,500))
dispatchGesture(gestureBuilder.build(),null,null)
我不知道问题出在哪里。我是 MERN 堆栈的新手。我该如何解决这个问题?
这是我的 POST API
Failed to load resource: the server responded with a status of 404 (Not Found)
这是前端的create方法。
router.post("/",async (req,res) => {
try {
const _id = await getNextSequence("courier")
req.body.id = _id
const courier = new CourierInfo(req.body)
await courier.save()
res.sendStatus(200)
} catch (error) {
res.sendStatus(500)
}
})
解决方法
我认为您的端点不一样。在前端,您使用的是“/courier”,而在后端,您只有“/”。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。