1.0.1 • Published 5 years ago

@sloang/express-json-sender v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

@sloang/express-json-sender

For people like me who hate typing res.status().json()

res.status().json() becomes => sender(status, json)

Usage

const express = require('express')
const app = express()

const sender = require('@sloang/express-json-sender')

app.post(sender(200, {test: 'test'}))

outputs

{"test": "test"}

API

let sender = require('@sloang/express-json-sender')
sender(status)

This method will call res.status with the status variable provided, send a empty response, and call next

sender(status, response)

This method will call res.status with the status variable provided , res.json with the response variable provided, and next

Install

With npm installed, run

$ npm install @sloang/express-json-sender

See Also

License

MIT

1.0.1

5 years ago

1.0.0

5 years ago