sendback

0.0.3 • Public • Published

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)

Package Sidebar

Install

npm i sendback

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

190 kB

Total Files

12

Last publish

Collaborators

  • seancdinan