- Node.js module for dispatching API responses.
- The plan is to build an easy-to-use helper for aligning API responses with these API Design Guidelines
"Taxidromos" is greek for "postman"
- Install the package via npm
$ npm install taxidromos --save
- Require the module in your
app.js(or whatever your main server file is called).
var taxidromos = ;
Sending proper data
Use case: Everything went fine & we should post
data to the caller.
- Sends provided
- Attaches an HTTP 200 status Code.
Sending errors (generic runtime errors)
Use case: Something went wrong in the code (use for runtime errors on server).
erroras is, so you can provide error information on your front-end.
- Attaches an HTTP 500 status Code.
Sending authentication errors
Use case: Caller login credentials do not authenticate at all (wrong username/password, etc).
- Sends neither
- Attaches an HTTP 401 (Unauthorized) status Code.
Sending forbidden access errors
Use case: Caller is authenticated (username/password is OK) but this caller doesn't have access to this particular API endpoint.
- Sends neither
- Attaches an HTTP 403 (Forbidden) status Code.
It's important that your taxidromos calls are within an
Otherwise there is no
request/req to use for responding.
Posting a response
Posts a response, attaching the appropriate HTTP status code.
||The actual result you want to send. Stringified internally, so make sure you provide an
LICENSE.md, in case this License has changed.
The MIT License (MIT)
Copyright (c) 2016 Nicholas Kyriakides
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.