apier-responsebuilder

Builds and sends the response of apier.

Usage no npm install needed!

<script type="module">
  import apierResponsebuilder from 'https://cdn.skypack.dev/apier-responsebuilder';
</script>

README

apier-responsebuilder Build Status

Builds and sends the response of apier.

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install apier-responsebuilder --save

API

init()

Used as middleware to initialize the response (that we will send at the end)

send(req, res, data)

req

Type: Object The request object

res

Type: Object The response object

data

Type: any The data to send as response

error(req, res, errorCode)

req

Type: Object The request object

res

Type: Object The response object

errorCode

Type: String The errorCode to send as response

Tests

npm install
npm test

Dependencies

  • reqlog: A simple Node.js logger. Very closely attached to a request.

Dev Dependencies

License

MIT

Generated by package-json-to-readme