async-response-aggregator-server

lightweight server to aggregate response from async requests


Keywords
async, lightweight, nodejs, response-aggregator, server
License
GPL-3.0
Install
npm install async-response-aggregator-server@0.2.2

Documentation

async-response-aggregator-server

A lightweight server to aggregate response from async requests

Scrutinizer Code Quality Code Coverage Build Status

Travis Build Status Node Versions

npm license

Install

$ git clone https://github.com/yoanm/async-response-aggregator-server.git
$ cd async-response-aggregator-server
$ yarn install

Usage

Server

# Switch to right node version
$ nvm use
# Start server
$ NODE_ENV=prod npm start
Running at http://localhost:8000

Documentation

Swagger documentation is available at /documentation

Request options

Uri

Endpoint URI

  • Required
  • Type: String
  • Allowed schemes: http, https

Method

Method to use

  • Type: String
  • Allowed Values: GET, POST, PUT, DELETE, PATCH
  • Default Value: GET

Payload

Payload to send (for POST request for instance)

  • Type: object, array, string
  • Default value: null

QueryString

Query string to send (for GET request for instance)

  • Type: object, array, string
  • Default value: null

Headers

Header to use

  • Type: object

Json

Whether to parse response as JSON or not

  • Type: boolean
  • Default value: true

Body example

  • GET request with query string (a=b&c[0]=1) and custom headers ({"plop": true}) :
{
    "method": "GET",
    "uri": "http://uri",
    "headers": {
        "plop": true
    },
    "queryString": "a=b&c[0]=1",
    "json": false
}
  • POST request with payload ({"property": "value"}) (response will be parsed as json)
{
    "method": "POST",
    "uri": "http://uri",
    "payload": {
        "property": "value"
    }
}
  • GET request with query string (a=b&c[0]=1) and custom headers ({"plop": true}) :
{
        "method": "GET",
        "uri": "http://uri",
        "headers": {
            "plop": true
        },
        "queryString": {
            "a": "b",
            "c": [
                1
            ]
        },
        "json": false
    }
]