I'm trying to decide on a consistent response JSON structure and I found this SO answer.
I like the simplicity of JSend but now I'm wondering what is a clean way to implement that structure in express
without having to manually create it each response or use a constructor in every controller method to help build the structure. I found jsend-express npm but it has so few downloads I'm worried about relying on it.
Can anyone recommend some ways to automatically enforce some of this structure in express myself?
However, I'm not sure why a status
key is even necessary when the 3 states seem to already be covered by HTTP statuses and I don't see this key recommended in google's style guide, so that's another reason I may not want to use the jsend
package and just do it myself to omit some keys and add later if needed.