api-helpers
A set of helpers functions to use on REST API developments
jsonfy
Returns a string to use in a REST response. Takes 2 parameters:
- message: A string to send information to the client.
- data: An object with thedata to response.
Usage:
var jsonfy = jsonfy; // Controller method on REST API { var data = {}; res;}
fail
Handler the errors in a request, returns status code 500
and the error message. Takes 2 parameters:
- err: The error from callback function
- res: The response to end the request Usage:
// Controller method on REST APIvar fail = fail { }
And more in coming...
License
MIT © 2105 Carlos Azaustre