How to use send in Locomotive Js

346 views Asked by At

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.

1

There are 1 answers

0
srquinn On BEST ANSWER

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);
}