@playma256/proxy-all-the-things

1.0.0 • Public • Published

Proxy All the Things!!

Motivations

Well, i faced a few situations where i need to create a reverse proxy on my interface to access another system which had no apis to query to. This is basically a well crafted wrapper that eases the creation of a reverse proxy, just asking for 2 options in order to achieve that.

Installation

npm install --save @playma256/proxy-all-the-things

yarn add -S @playma256/proxy-all-the-things

Usage

Instantiate a class passing all options to the constructor.

const Proxy = require('@playma256/proxy-all-the-things');

// pass options
const ProxyInstance = new Proxy({
	baseUrl: "https://www.mytargetlocation.com",
	internalPath: "/myServerRoot"
});

// ...

// attach to your router
// This url has to be the same as the one inserted at the internalPath option
app.all('/myServerRoot*', ProxyInstance.proxyHandler);

Options

Property Description
internalPath Path that the proxy is going to start in your server
baseUrl Url of the website you are going to reverse proxy to

Package Sidebar

Install

npm i @playma256/proxy-all-the-things

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

4.01 kB

Total Files

3

Last publish

Collaborators

  • playma256