Skip to content

A package for people who are tired of writing req.status().json() and the like

License

Notifications You must be signed in to change notification settings

sloanbgwaltney/json-sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@sloang/express-json-sender

For people like 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 status provided, send a empty json response, and call next

sender(status, obj)

This method will call res.status, res.json and next

Install

With npm installed, run

$ npm install @sloang/express-json-sender

See Also

License

MIT

About

A package for people who are tired of writing req.status().json() and the like

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published