我有一个 Iron-router 路由,我想通过 HTTP POST 请求接收 lat/lng 数据。
这是我的尝试:
Router.map(function () {
this.route('serverFile', {
path: '/receive/',
where: 'server',
action: function () {
var filename = this.params.filename;
resp = {'lat' : this.params.lat,
'lon' : this.params.lon};
this.response.writeHead(200, {'Content-Type': 'application/json; charset=utf-8'});
this.response.end(JSON.stringify(resp));
}
});
});
但查询服务器:
curl --data "lat=12&lon=14" http://127.0.0.1:3000/receive
退货{}
。
也许params
不包含发布数据?我试图检查对象和请求,但找不到。