res.ok()
This method is used to send a 200 ("OK") response back down to the client.
return res.ok();
Or:
return res.ok(data);
Like the other built-in custom response modules, the behavior of this method is customizable.
By default, it works as follows:
data
as JSON. If no data
is provided, a default response body will be sent (the string "OK"
).return res.ok();
- This method is terminal, meaning that it is generally the last line of code your app should run for a given request (hence the advisory usage of
return
throughout these docs).res.ok()
(like other userland response methods) can be overridden or modified. It runs the response method defined inapi/responses/ok.js
. If anok.js
response method does not exist in your app, Sails will use the default behavior.