0
从接收到来自客户端的请求参数的节点服务器发送POST请求的最佳方式是什么?
我要求最佳做法的原因是,如果多个客户端正在调用节点服务,它不应该影响响应时间。
这里是骨干示范它发送到节点的请求服务器:向节点服务器发送第三方服务的请求
var LoginModel = Backbone.Model.extend({
url:'http://localhost:3000/login',
defaults: {
email:"",
password:""
},
parse: function(resp) {
return resp;
},
login: function() {
console.log('Here in the model'+JSON.stringify(this));
this.save();
}
});
var loginModel = new LoginModel();
节点服务器
var http = require('http'),
express = require('express');
var app = express();
app.listen(3000);
app.post('/login', [express.urlencoded(), express.json()], function(req, res) {
console.log('You are here'); console.log(JSON.stringify(req.body));
//Send the post request to third party service.
});
我应该使用类似requestify
内app.post()
功能并拨打电话至第三派对服务?
谢谢@PeterLynos。只需确认一下,可以从'app.post()'调用另一个服务。 –
当然,如果这对您的应用程序是有意义的,当然。 –