Skip to content

labithiotis/status-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

status-codes

NPM Version NPM Downloads

Small module to return all known HTTP status with a name and brief description.

Installation

$ npm install status-codes --save

Using

All codes from this Wiki HTTP Status Codes

    
    var statusCodes = require('status-codes');

	statusCodes[404];
		
	/** 
	
	Returns:
	
	{
		"status": 404,
		"name": "Not Found",
		"message": "The server has not found anything matching the Request-URI."
	}
	
	**/
	
	// OR use a get method that has a fallback to a code 400 if it doesn't find a valid code
	
	statusCodes.get(536727);
	
	/** 
	
	Returns:
	
	{
		"status": 400,
		"name": "Bad Request",
		"message": "The server cannot or will not process the request."
	}
	
	**/

Constants

Can retrive HTTP status by name too:

	statusCodes.NOT_FOUND;
		
	/** 
	
	Returns:
	
	{
		"status": 404,
		"name": "Not Found",
		"message": "The server has not found anything matching the Request-URI."
	}
	
	**/

About

Node Module to return HTTP Status Codes objects with name and message

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published