jasenda
![License](https://img.shields.io/github/license/zishone/jasenda)
A middleware to add jsend helper functions to the response object.
Installation
$ npm i @zishone/jasenda
Usage
const express = require('express');
const { jsend } = require('@zishone/jasenda');
const app = express();
app.use(jsend());
app.get('/success', (req, res) => {
res.jsend.success({ });
});
app.get('/fail', (req, res) => {
res.jsend.fail({ });
});
app.get('/error', (req, res) => {
res.jsend.fail('An error message');
});
app.listen(port, () => {
console.log('Listening at port 3000')
})
Authors
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE file for details.