TramwayJS

Status Codes

It's common to return different status codes with the response at the controller-level. Bundled with the tramway-core-router library is the node-http-status library by @prettymuchbryce which provides enums for different status codes.

To access the enum:

import {HttpStatus} from 'tramway-core-router';
//for 200
HttpStatus.OK;

Full table of supported Enums:

ConstantCodeStatus Text
CONTINUE100Continue
SWITCHING_PROTOCOLS101Switching Protocols
PROCESSING102Processing
OK200OK
CREATED201Created
ACCEPTED202Accepted
NON_AUTHORITATIVE_INFORMATION203Non Authoritative Information
NO_CONTENT204No Content
RESET_CONTENT205Reset Content
PARTIAL_CONTENT206Partial Content
MULTI_STATUS207Multi-Status
MULTIPLE_CHOICES300Multiple Choices
MOVED_PERMANENTLY301Moved Permanently
MOVED_TEMPORARILY302Moved Temporarily
SEE_OTHER303See Other
NOT_MODIFIED304Not Modified
USE_PROXY305Use Proxy
TEMPORARY_REDIRECT307Temporary Redirect
PERMANENT_REDIRECT308Permanent Redirect
BAD_REQUEST400Bad Request
UNAUTHORIZED401Unauthorized
PAYMENT_REQUIRED402Payment Required
FORBIDDEN403Forbidden
NOT_FOUND404Not Found
METHOD_NOT_ALLOWED405Method Not Allowed
NOT_ACCEPTABLE406Not Acceptable
PROXY_AUTHENTICATION_REQUIRED407Proxy Authentication Required
REQUEST_TIMEOUT408Request Timeout
CONFLICT409Conflict
GONE410Gone
LENGTH_REQUIRED411Length Required
PRECONDITION_FAILED412Precondition Failed
REQUEST_TOO_LONG413Request Entity Too Large
REQUEST_URI_TOO_LONG414Request-URI Too Long
UNSUPPORTED_MEDIA_TYPE415Unsupported Media Type
REQUESTED_RANGE_NOT_SATISFIABLE416Requested Range Not Satisfiable
EXPECTATION_FAILED417Expectation Failed
IM_A_TEAPOT418I'm a teapot
INSUFFICIENT_SPACE_ON_RESOURCE419Insufficient Space on Resource
METHOD_FAILURE420Method Failure
UNPROCESSABLE_ENTITY422Unprocessable Entity
LOCKED423Locked
FAILED_DEPENDENCY424Failed Dependency
PRECONDITION_REQUIRED428Precondition Required
TOO_MANY_REQUESTS429Too Many Requests
REQUEST_HEADER_FIELDS_TOO_LARGE431Request Header Fields Too Large
INTERNAL_SERVER_ERROR500Server Error
NOT_IMPLEMENTED501Not Implemented
BAD_GATEWAY502Bad Gateway
SERVICE_UNAVAILABLE503Service Unavailable
GATEWAY_TIMEOUT504Gateway Timeout
HTTP_VERSION_NOT_SUPPORTED505HTTP Version Not Supported
INSUFFICIENT_STORAGE507Insufficient Storage
NETWORK_AUTHENTICATION_REQUIRED511Network Authentication Required