来自 ajax post 的 Drakov http 状态代码 404

Drakov http status code 404 from ajax post

我使用带有 api 蓝图 md 文件的 drakov 模拟服务器。我想发送一个 POST 请求,但我总是收到状态码 404。

我使用一个简单的jQuery代码:

var url = "http://localhost:3000/student/1/setfinalcommit";
var data = {first: "exampl"};
$.ajax({
    url: url,
    type: 'post',
    dataType: 'json',
    contentType: "application/json",
    success: function (data) {
        console.log(data)
    },
    data: data
});

虽然它不适用于我的 JS 代码,但它适用于 curl: curl -H "Content-Type: application/json" -X POST -d '{"first" : "exampl"}' http://localhost:3000/student/1/setfinalcommit

我的 .md 文件:

留言[/student/{userid}/setfinalcommit]

Post 到第一个例子 [POST]

我的问题是: 我搞砸了蓝图,还是 ajax 请求?

谢谢!

我搞砸了后端。我不得不像这样启动 drakov:

drakov -f myfile.md --autoOptions