Easily reply to your request with a statusCode and optional headers
npm install hapi-status --save
var status = require('hapi-status');
// ...
server.route({
method: 'GET',
path: '/'
handler: function(request, reply) {
var result = 'whatever you want to give back to the client';
return status.ok(reply, result);
}
});
// ...
- continue
- switchingProtocols
- processing
- ok
- created
- accepted
- nonAuthoritativeInformation
- noContent
- resetContent
- partialContent
- multiStatus
- multipleChoices
- movedPermanently
- movedTemporarily
- seeOther
- notModified
- useProxy
- unused
- temporaryRedirect
- badRequest
- unauthorized
- paymentRequired
- forbidden
- notFound
- methodNotAllowed
- notAcceptable
- proxyAuthenticationRequired
- requestTimeout
- conflict
- gone
- lengthRequired
- preconditionFailed
- requestEntityTooLarge
- requestUriTooLong
- unsupportedMediaType
- requestedRangeNotSatisfiable
- expectationFailed
- iAmATeapot
- unprocessableEntity
- locked
- failedDependency
- upgradeRequired
- preconditionRequired
- tooManyRequests
- requestHeaderFieldsTooLarge
- unavailableForLegalReasons
- internalServerError
- notImplemented
- badGateway
- serviceUnavailable
- gatewayTimeout
- httpVersionNotSupported
- insufficientStorage
- networkAuthenticationRequired-