npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

backend-proxy

v0.0.13

Published

A command line utility that proxies a backend API

Downloads

35

Readme

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 | |

Usecases

  • Proxies cookies properly by removing the scoped domain
  • Adds proper CORs headers allowing full access from the browser
  • Supports POST requests and proxies them transparently
  • Read Only mode allows easy testing for backend APIs where accidental changes are prevented

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

URL mappings

--map option can be used to select a url if multiple urls are given. This can be used in scenarios where multiple paths map to different urls.

$ backend-proxy --url http://url_1.com --url http://url_2.com --map "/users -> 0" --map "/posts -> 1"

In above example, /users/25 will proxy to http://url_1.com/users/25 where as /posts/22 will proxy to http://url_2.com/posts/22 Note that url that comes first gets precedence. Either the first mapping matched will be used, or fall back to first url given. The mapped number is an index, and starts from 0 not 1

License

Licensed under the MIT License

View this on npm

Made with ❤ by Rikin Katyal