문제

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