@hellofiremind/http-variables
v1.0.1
Published
Includes HTTP Constants that you can use within your codebase.
Downloads
4
Readme
node-http-variables
Includes HTTP Constants that you can use within your codebase.
Codes
import { codes } from '@hellofiremind/http-variables'
const handler = (req, res, next) => {
try {
// Do something here
} catch (error) {
res
.sendStatus(codes.INTERNAL_SERVER_ERROR) // 500
}
}
Available Codes
- ACCEPTED
- BAD_GATEWAY
- BAD_REQUEST
- CONFLICT
- CONTINUE
- CREATED
- EXPECTATION_FAILED
- FAILED_DEPENDENCY
- FORBIDDEN
- GATEWAY_TIMEOUT
- GONE
- HTTP_VERSION_NOT_SUPPORTED
- IM_A_TEAPOT
- INSUFFICIENT_SPACE_ON_RESOURCE
- INSUFFICIENT_STORAGE
- INTERNAL_SERVER_ERROR
- LENGTH_REQUIRED
- LOCKED
- METHOD_FAILURE
- METHOD_NOT_ALLOWED
- MOVED_PERMANENTLY
- MOVED_TEMPORARILY
- MULTI_STATUS
- MULTIPLE_CHOICES
- NETWORK_AUTHENTICATION_REQUIRED
- NO_CONTENT
- NON_AUTHORITATIVE_INFORMATION
- NOT_ACCEPTABLE
- NOT_FOUND
- NOT_IMPLEMENTED
- NOT_MODIFIED
- OK
- PARTIAL_CONTENT
- PAYMENT_REQUIRED
- PERMANENT_REDIRECT
- PRECONDITION_FAILED
- PRECONDITION_REQUIRED
- PROCESSING
- PROXY_AUTHENTICATION_REQUIRED
- REQUEST_HEADER_FIELDS_TOO_LARGE
- REQUEST_TIMEOUT
- REQUEST_TOO_LONG
- REQUEST_URI_TOO_LONG
- REQUESTED_RANGE_NOT_SATISFIABLE
- RESET_CONTENT
- SEE_OTHER
- SERVICE_UNAVAILABLE
- SWITCHING_PROTOCOLS
- TEMPORARY_REDIRECT
- TOO_MANY_REQUESTS
- UNAUTHORIZED
- UNPROCESSABLE_ENTITY
- UNSUPPORTED_MEDIA_TYPE
- USE_PROXY
Messages
import { codes, message } from '@hellofiremind/http-variables'
const handler = (req, res, next) => {
try {
// Do something here
} catch (error) {
res
.status(codes.INTERNAL_SERVER_ERROR) // 500
.send(message[codes.INTERNAL_SERVER_ERROR]) // INTERNAL_SERVER_ERROR
}
}
Available Messages
- 202
- 502
- 400
- 409
- 100
- 201
- 417
- 424
- 403
- 504
- 410
- 505
- 418
- 419
- 507
- 500
- 411
- 423
- 420
- 405
- 301
- 302
- 207
- 300
- 511
- 204
- 203
- 406
- 404
- 501
- 304
- 200
- 206
- 402
- 308
- 412
- 428
- 102
- 407
- 431
- 408
- 413
- 414
- 416
- 205
- 303
- 503
- 101
- 307
- 429
- 401
- 422
- 415
- 305