frest.js — Facade REST — Send multiple HTTP REST API requests in one go and get aggregated response

A typical web application generally needs to sends multiple HTTP REST API requests one by one and then process their response. Managing multiple promise callbacks are tedious.

That’s why frest.js exists.

Install

You can get it from npm repository.

npm install frestjs --save

Setup

First, include the script located on the distfolder.

Or you can use CDN Server

Usage

casecaded() — Sends multiple HTTP REST request by casecading response parameters

There are situation when one HTTP REST APIs response needs to be processed to get some parameter and this parameter needs to be passed to next HTTP REST requests.

casecaded() function does this for you.

waterfall() — Sends multiple HTTP REST request one by one

To send HTTP REST requests one after another you can use waterfall() function.

getAll() — Sends multiple GET requests

A pretty common use case is to fetch multiple resources from different REST APIs.

getAll() accepts array of REST API urls and returns a promise object whose response contains aggregated response of all REST APIs.

postAll() — sends multiple POST requests

putAll() — sends multiple PUT requests

It is similar to postAll() requests.

deleteAll() — Sends multiple DELETE requests

deleteAll() accepts array of REST API urls and returns a promise object whose response contains aggregated response of all REST APIs.

Cloud Solution Architect | Author | Full Stack Developer | https://www.linkedin.com/in/balram-chavan | https://www.hiretheauthor.com/balramchavan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store