Iron-
router中的连接框架使用bodyParser中间件来解析主体中发送的数据。bodyParser使该数据在
request.body对象中可用。
以下对我有用:
Router.map(function () { this.route('serverFile', { path: '/receive/', where: 'server', action: function () { var filename = this.params.filename; resp = {'lat' : this.request.body.lat, 'lon' : this.request.body.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{"lat":"12","lon":"14"}另请参见此处:http :
//www.senchalabs.org/connect/bodyParser.html



