[英]How to use send in Locomotive Js
How can I use send() in action of controller in locomotive Js. 如何在机车Js的控制器中使用send()。 I think LCM only provides render().
我认为LCM只提供render()。 Can some one guide me in this regards.
有人可以在这方面指导我。
Locomotivejs is just an extension of Express, meaning a Loco app is an Express app. Locomotivejs只是Express的扩展,这意味着Loco应用程序是Express应用程序。 From the docs:
来自文档:
Request and Response
请求和响应
If an application needs access to the raw request and response, each is available as an instance variable within the controller.
如果应用程序需要访问原始请求和响应,则每个应用程序都可用作控制器中的实例变量。
PhotosController.show = function() { var req = this.req; // also aliased as this.request var res = this.res; // also aliased as this.response this.render(); }
So from within your controller, simply: 因此,从您的控制器中,只需:
MyController.myAction = function () {
this.res.send(200);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.