How can I use send() in action of controller in locomotive Js. I think LCM only provides render(). Can some one guide me in this regards.

有帮助吗?

解决方案

Locomotivejs is just an extension of Express, meaning a Loco app is an Express app. 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归因
不隶属于 StackOverflow
scroll top