rest-api-proxy-middleware

0.2.0 • Public • Published

REST API Proxy Middleware

Express oriented middleware which make the proxying simple with REST APIs.

Built on top of native Node.js modules, without any dependencies.

Installation

# npm ..
$ npm install rest-api-proxy-middleware
# yarn ..
$ yarn add rest-api-proxy-middleware

Usage

This is a practical example of how to use.

const express = require('express');
const { restApiProxyMiddleware } = require ('rest-api-proxy-middleware');
const app = express();

const target = 'http://jsonplaceholder.typicode.com/todos/1';
app.use('/proxy-gateway', restApiProxyMiddleware({ target }));

// We have extra options can be passed like:
// - httpClient: help to replace the default native 'http' module with 'https'.
// - onError: help to handle the produced errors.
// We ship 'isURL' helper, which check if the passed string is a valid url or not!

License


MIT © Imed Jaberi

Package Sidebar

Install

npm i rest-api-proxy-middleware

Weekly Downloads

8

Version

0.2.0

License

MIT

Unpacked Size

7.79 kB

Total Files

11

Last publish

Collaborators

  • 3imed-jaberi