handleRes
A small (< 60 loc) helper library to handle response calls in express like frameworks.
Install
npm install handle-res
Usage
The handleRes module is split into 2 main methods, .accept
, and .reject
.
The reason that .reject
sends back the Status: OK
http code is to allow developers to create their own failure context. Use .reject
when you are able to determine the error. For example, if a user enters a wrong password to your verifyLogin
route, you should do:
app
Of course the above could be made more sophisticated via automatic error codes, custom error types, etc.
Quick Reference
const express = const handleRes = const app = app app