A command line utility that proxies a backend API
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
.babelrc
.gitignore Add .DS_Store to gitignore Sep 20, 2017
LICENSE
README.md
package-lock.json
package.json

README.md

backend-proxy

CircleCI npm version npm

Backend proxy is a tool to route your REST API through a proxy

Install

$ npm i -g backend-proxy

Usage

$ backend-proxy --url PROXY_URL --token-name --token TOKEN --use-headers --port 3000 --read-only

Options

Option Input Default Required
--port Port on which proxy will serve requests 3000
--url Url to proxy to N/A *
--secure Listen over https instead of http. Will use a test self signed certificate false
--token-name Name of the token query parameter / header name used to pass token token
--token Token to use for requests N/A
--use-headers Pass token as a http header instead of a url query string false
--read-only Only allow GET requests false
--rewrite Transforms paths from when proxying request *
--debug Print extra information for debugging false
--secure Print extra information for debugging false

Example

$ backend-proxy --url https://reqres.in/api

Then

GET http://localhost:3000/users/2

proxies to

GET https://reqres.in/api/users/2

Path Rewrites

--rewrite option can be used multiple times to transform many paths like so:

$ backend-proxy --url https://reqres.in/api --rewrite "/users -> /clients" --rewrite "/customers -> /clients"

Then

GET http://localhost:3000/users/2
GET http://localhost:3000/customers/4

proxies to

GET https://reqres.in/api/clients/2
GET https://reqres.in/api/clients/4

License

Licensed under the MIT License

View this on npm

Made with ❤ by Rikin Katyal