Javascript 我们如何使用meteor restivus发布数据

Javascript 我们如何使用meteor restivus发布数据,javascript,api,post,meteor,Javascript,Api,Post,Meteor,我正在使用meteor restivus包开发API,我想发布数据并保存在数据库中。我已经完成了以下编码,但无法在api调用中获得发布的数据 // made post api using restivus Restivus.configure({ useAuth: false, prettyJson: true }); Restivus.addRoute('addorder', {authRequired: true}, { post:{ action: function

我正在使用meteor restivus包开发API,我想发布数据并保存在数据库中。我已经完成了以下编码,但无法在api调用中获得发布的数据

// made post api using restivus
Restivus.configure({
    useAuth: false,
    prettyJson: true
});
Restivus.addRoute('addorder', {authRequired: true}, {
post:{
    action: function (data) {
        console.log(data); // undefined
        return {status: "success", data: "test"};
    }
}
});
在上面的api中,我使用服务器端方法调用,因为我已经完成了以下编码

 Meteor.methods({
    apiInsert:function (name){
        this.unblock();
        console.log("api insert method");
        var url = "http://localhost:3000/api/addorder";
        var result = HTTP.post(url,{
    data: { "name": name },
    headers:{
          "content-type":"application/json ; charset=UTF-8",
    }
  });

但我并没有在api函数中得到发布的数据,而是在数据变量中得到了未定义的数据。我不知道如何在api函数中检索发布的数据

尝试使用此.bodyParams

 post:  {
       action: function () {
          return {status: 'success', data: this.bodyParams};
      }