multi-resource

A simple API gateway middleware

Usage no npm install needed!

<script type="module">
  import multiResource from 'https://cdn.skypack.dev/multi-resource';
</script>

README

multi-resource

Build Status Maintainability Test Coverage

An express middleware to fetch multiple resources from API with one request

Installation

npm i multi-resource

Usage

const express = require('express');
const mr = require('multi-resource');

const app = express();
app.use(mr());

app.listen(3000);
curl http://localhost:3000/api/resources?users=api/users

Also, see example

Options

  • basePath - ('api')
  • url - ('resources')

Limitations

  • Will not work with non application/json APIs
  • Will not work if API returns status code different from 200