res
)Sails is built on Express and uses Node's HTTP server conventions. As a result, you can access all of the Node and Express methods and properties on the res
object wherever it is accessible (i.e. in your actions, helpers, and policies).
One of the benefits of this compatibility is that, in many cases, you can paste existing Node.js code into a Sails app and it will work. And since Sails implements a transport-agnostic request interpreter, the code in your Sails app is WebSocket-compatible as well.
Sails adds a few methods of its own to the res
object, like res.badRequest()
, res.serverError()
, res.view()
. These features are syntactic sugar on top of the underlying implementation, and support both HTTP and (in many cases) WebSockets.