Skip to content

Express middleware that exposes functions to work with HTTP status codes

License

Notifications You must be signed in to change notification settings

brenolf/pretty-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pretty Response

Build Status Coverage Status Code Climate npm version

Express middleware that exposes functions to work with HTTP status codes

Pretty Response exposes all HTTP codes as functions on response as a middleware. So you can plug it wherever you want to and have a more expressive code than using standard response.status(CODE).

Install

$ npm install --save-dev pretty-response

Usage

var express = require('express')
var pretty = require('pretty-response')

var app = express()
	.use(pretty)

Or you can use specifically on the routes you want to.

Then you can use descriptive names as functions to create RFC 2616 specific response:

app
.get('/', function (req, res, next) {
	res.ok().send()
})

All functions are using camel-cased names. For instance notFound, internalServerError and created. It's easier if you take a look at the the codes file.

License

MIT

About

Express middleware that exposes functions to work with HTTP status codes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages