0.0.3 • Published 7 years ago
sendback v0.0.3
SendBack
A simple utility for formatting HTTP responses in an Express/Node application.
Note: This project is under active development. The current version is intended to provide bare-bones functionality. Configuration, additional functionality, and more thorough documentation will follow.
How to Use
import sendback from 'sendback';
const SendBack = new sendback();
async function fetchUser(req, res){
const user = await getUserByID(req.body.userID);
SendBack.success(res, user);
}Methods
config(options)success(res, data)unauthorized(res, err, message, data)methodNotAllowed(res, err, message, data)invalidContent(res, err, message, data)unavailable(res, err, message, data)serverError(res, err, message, data)