Adding JSend methods to Express 3.x

About JSend

JSend is a specification for how web servers should respond when they respond via JSON. I find it useful mainly for quickly parsing error and success response differences.  One could use HTTP error codes (I don’t know why), but JSend is useful for keeping the client receiver simple and generic when handling responses. 

JSend Success Example
{status: “success”, data: “this could be a json object”}

JSend Error Example
{status: “error”, code: “InvalidParamter”, message: “Name is required.”}

Adding it to Expressjs

The following is a middleware example…

Loading ….

Now, a prototype example…



Published by and tagged express, jsend and node using 92 words.