Spirit Error
Easily Return HTTP Errors from Spirit
Supports JSON, HTML, Text and dynamic errors.
Usage
// tell spirit-error to create JSON responsesconst error = // inside a spirit functionreturn errornotFound
Returns this HTTP response:
HTTP/1.1 404 Not FoundContent-Type: application/json; charset=utf-8
Install
With npm installed, run
npm install --save spirit-error
or use yarn:
yarn add spirit-error