express-response-api
JSON API response format for Express
Usage
const responseApi = ;app;router;
Option
;res; // { status: { code: 1, msg: 'Success' }, data: {id: 1} }
;res; // { code: 1, message: 'Success', data: {id: 1} }
Examples
const code = 1; // Error Codeconst message = 'Response Message';const data = id: 0 ; // Full Argsres; // [1, 'Response Message', { id: 0 }] // Success Responseres; // [0, '', { id: 0 }]res; // [0, '', {}]; // Success/Error Responseres; // [1, 'Response Message', {}]res; // [1, '', { id: 0 }]res; // [1, '', {}]