npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

express-status

v1.0.10

Published

status code response helper

Downloads

447

Readme

express-status

Extends express response prototype with status codes helper methods.

Build Status Coverage Status

Purpose

The purpose of this library is to remove magic numbers from your code and define the status codes in one place.

Install

npm install express-status

Test

test with code coverage

gulp

unit test only

gulp test

Document

Documentation is managed by commenting code with jsdoc and editing the template. You can regenerate the README.md by executing

gulp doc
<a name="module_express-status"></a>

express-status

Exports an object with status codes and extends the express request object by adding a method that will set the status code and return the request object.

Example

var statusCodes = require()

express-status.switchingProtocols()

sets res status code to 101

Kind: static method of express-status
Example

function(req, res){
 res.switchingProtocols().end();
}

express-status.processing()

sets res status code to 102

Kind: static method of express-status
Example

function(req, res){
 res.processing().end();
}

express-status.ok()

sets res status code to 200

Kind: static method of express-status
Example

function(req, res){
 res.ok().end();
}

express-status.created()

sets res status code to 201

Kind: static method of express-status
Example

function(req, res){
 res.created().end();
}

express-status.accepted()

sets res status code to 202

Kind: static method of express-status
Example

function(req, res){
 res.accepted().end();
}

express-status.nonAuthoritative()

sets res status code to 203

Kind: static method of express-status
Example

function(req, res){
 res.nonAuthoritative().end();
}

express-status.noContent()

sets res status code to 204

Kind: static method of express-status
Example

function(req, res){
 res.noContent().end();
}

express-status.resetContent()

sets res status code to 205

Kind: static method of express-status
Example

function(req, res){
 res.resetContent().end();
}

express-status.partialContent()

sets res status code to 206

Kind: static method of express-status
Example

function(req, res){
 res.partialContent().end();
}

express-status.multiStatus()

sets res status code to 207

Kind: static method of express-status
Example

function(req, res){
 res.multiStatus().end();
}

express-status.alreadyReported()

sets res status code to 208

Kind: static method of express-status
Example

function(req, res){
 res.alreadyReported().end();
}

express-status.imUsed()

sets res status code to 226

Kind: static method of express-status
Example

function(req, res){
 res.imUsed().end();
}

express-status.multipleChoices()

sets res status code to 300

Kind: static method of express-status
Example

function(req, res){
 res.multipleChoices().end();
}

express-status.movedPermanently()

sets res status code to 301

Kind: static method of express-status
Example

function(req, res){
 res.movedPermanently().end();
}

express-status.found()

sets res status code to 302

Kind: static method of express-status
Example

function(req, res){
 res.found().end();
}

express-status.seeOther()

sets res status code to 303

Kind: static method of express-status
Example

function(req, res){
 res.seeOther().end();
}

express-status.notModified()

sets res status code to 304

Kind: static method of express-status
Example

function(req, res){
 res.notModified().end();
}

express-status.useProxy()

sets res status code to 305

Kind: static method of express-status
Example

function(req, res){
 res.useProxy().end();
}

express-status.switchProxy()

sets res status code to 306

Kind: static method of express-status
Example

function(req, res){
 res.switchProxy().end();
}

express-status.temporaryRedirect()

sets res status code to 307

Kind: static method of express-status
Example

function(req, res){
 res.temporaryRedirect().end();
}

express-status.permanentRedirect()

sets res status code to 308

Kind: static method of express-status
Example

function(req, res){
 res.permanentRedirect().end();
}

express-status.badRequest()

sets res status code to 400

Kind: static method of express-status
Example

function(req, res){
 res.badRequest().end();
}

express-status.unauthorized()

sets res status code to 401

Kind: static method of express-status
Example

function(req, res){
 res.unauthorized().end();
}

express-status.forbidden()

sets res status code to 403

Kind: static method of express-status
Example

function(req, res){
 res.forbidden().end();
}

express-status.notFound()

sets res status code to 404

Kind: static method of express-status
Example

function(req, res){
 res.notFound().end();
}

express-status.methodNotAllowed()

sets res status code to 405

Kind: static method of express-status
Example

function(req, res){
 res.methodNotAllowed().end();
}

express-status.notAcceptable()

sets res status code to 406

Kind: static method of express-status
Example

function(req, res){
 res.notAcceptable().end();
}

express-status.proxyAuthenticationRequired()

sets res status code to 407

Kind: static method of express-status
Example

function(req, res){
 res.proxyAuthenticationRequired().end();
}

express-status.requestTimeout()

sets res status code to 408

Kind: static method of express-status
Example

function(req, res){
 res.requestTimeout().end();
}

express-status.conflict()

sets res status code to 409

Kind: static method of express-status
Example

function(req, res){
 res.conflict().end();
}

express-status.gone()

sets res status code to 410

Kind: static method of express-status
Example

function(req, res){
 res.gone().end();
}

express-status.lengthRequired()

sets res status code to 411

Kind: static method of express-status
Example

function(req, res){
 res.lengthRequired().end();
}

express-status.preconditionFailed()

sets res status code to 412

Kind: static method of express-status
Example

function(req, res){
 res.preconditionFailed().end();
}

express-status.requestEntityTooLarge()

sets res status code to 413

Kind: static method of express-status
Example

function(req, res){
 res.requestEntityTooLarge().end();
}

express-status.requestUriTooLang()

sets res status code to 414

Kind: static method of express-status
Example

function(req, res){
 res.requestUriTooLang().end();
}

express-status.unsupportedMediaType()

sets res status code to 415

Kind: static method of express-status
Example

function(req, res){
 res.unsupportedMediaType().end();
}

express-status.requestedRangeNotSatisfiable()

sets res status code to 416

Kind: static method of express-status
Example

function(req, res){
 res.requestedRangeNotSatisfiable().end();
}

express-status.expectationFailed()

sets res status code to 417

Kind: static method of express-status
Example

function(req, res){
 res.expectationFailed().end();
}

express-status.imATeapot()

sets res status code to 418

Kind: static method of express-status
Example

function(req, res){
 res.imATeapot().end();
}

express-status.authenticationTimeout()

sets res status code to 419

Kind: static method of express-status
Example

function(req, res){
 res.authenticationTimeout().end();
}

express-status.locked()

sets res status code to 423

Kind: static method of express-status
Example

function(req, res){
 res.locked().end();
}

express-status.failedDependency()

sets res status code to 424

Kind: static method of express-status
Example

function(req, res){
 res.failedDependency().end();
}

express-status.upgradeRequired()

sets res status code to 426

Kind: static method of express-status
Example

function(req, res){
 res.upgradeRequired().end();
}

express-status.preconditionRequired()

sets res status code to 428

Kind: static method of express-status
Example

function(req, res){
 res.preconditionRequired().end();
}

express-status.tooManyRequests()

sets res status code to 429

Kind: static method of express-status
Example

function(req, res){
 res.tooManyRequests().end();
}

express-status.requestHeaderFieldTooLarge()

sets res status code to 431

Kind: static method of express-status
Example

function(req, res){
 res.requestHeaderFieldTooLarge().end();
}

express-status.loginTimeout()

sets res status code to 440

Kind: static method of express-status
Example

function(req, res){
 res.loginTimeout().end();
}

express-status.unavailableForLegalReasons()

sets res status code to 451

Kind: static method of express-status
Example

function(req, res){
 res.unavailableForLegalReasons().end();
}

express-status.internalServerError()

sets res status code to 500

Kind: static method of express-status
Example

function(req, res){
 res.internalServerError().end();
}

express-status.notImplemented()

sets res status code to 501

Kind: static method of express-status
Example

function(req, res){
 res.notImplemented().end();
}

express-status.badGateway()

sets res status code to 502

Kind: static method of express-status
Example

function(req, res){
 res.badGateway().end();
}

express-status.serviceUnavailable()

sets res status code to 503

Kind: static method of express-status
Example

function(req, res){
 res.serviceUnavailable().end();
}

express-status.gatewayTimeout()

sets res status code to 504

Kind: static method of express-status
Example

function(req, res){
 res.gatewayTimeout().end();
}

express-status.httpVersionNutSupported()

sets res status code to 505

Kind: static method of express-status
Example

function(req, res){
 res.httpVersionNutSupported().end();
}

express-status.variantAlsoNegotiates()

sets res status code to 506

Kind: static method of express-status
Example

function(req, res){
 res.variantAlsoNegotiates().end();
}

express-status.insufficientStorage()

sets res status code to 507

Kind: static method of express-status
Example

function(req, res){
 res.insufficientStorage().end();
}

express-status.loopDetected()

sets res status code to 508

Kind: static method of express-status
Example

function(req, res){
 res.loopDetected().end();
}

express-status.notExtended()

sets res status code to 510

Kind: static method of express-status
Example

function(req, res){
 res.notExtended().end();
}

express-status.networkAuthenticationRequired()

sets res status code to 511

Kind: static method of express-status
Example

function(req, res){
 res.notExtended().end();
}