multiget
multiget — express middleware that allow aggregate few api request into one response
Installation
npm install multiget
API
multiget(apiHost) — creates middleware
Example
var express = multiget = app = ; app;app;
Response format
Calling GET http://localhost:3000/api/multi?key1=api1&key2=api2
for example above will made following requests:
GET http://localhost:4000/api1
GET http://localhost:4000/api2
and will combine responces into one:
key1: result: /*api responce*/ error: /*error message*/ key2: result: /*api responce*/ error: /*error message*/
if API will set content-type
to application/json
the middleware will trying to parse response
fields error
and result
are mutually exclusive
Tests
npm test