res-handle
Middleware for express. Adds handle method to res and can be easily used as a callback to make your code look cleaner. res.handle accept two argument: error and data. In the case of an error, it will return status 400. Otherwise it will return status 200 along with any provided data.
Install
$ npm install res-handle
Usage
Require:
const handle = ;
Add Middleware:
app;
Pass in callback:
Model
Call in function:
// do stuff if err return ; ;);