[英]404 Not Found On A Post Route
I Am Sending A Post Request To This Route But It Is Not Working And Sending Me A 404 Not Found Here Is The Code For The Route我正在向这条路线发送邮政请求,但它不起作用并向我发送 404 未在此处找到这是该路线的代码
app.post('/case/new', (req, res) => {
Case.create({
name: req.query.name,
paid: req.query.paid,
assigned: req.query.assigned,
description: req.query.description,
date: req.query.date,
}, (err, created) => {
if(err){
console.log(err)
} else {
res.send(created)
}
})
})
And I Am Sending The Request Using jQuery here Is The jQuery Code我正在使用 jQuery 发送请求,这里是 jQuery 代码
$.ajax({
url: 'https://modern-clinic.herokuapp.com/new/case',
type: 'POST',
data: {
name: this.state.name,
description: this.state.desc,
paid: this.state.paid,
assigned: this.state.assigned,
date: this.state.date
}
})
$.ajax({
url: 'https://modern-clinic.herokuapp.com/new/case',
type: 'POST',
dataType: 'json',
data: {
name: this.state.name,
description: this.state.desc,
paid: this.state.paid,
assigned: this.state.assigned,
date: this.state.date
}
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.