1.0.9 • Published 1 year ago

dev-backend-proxy v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

About The Project

Frontend developers often face with case, where they should use remote API development server. And if it uses https protocol and some sort cookie-based authorization and/or CORS, you should run https dev environment, that not so often easy to run.

Special case - development under Windows with Docker... It's some sort of BDSM :) And it's a right decision to use remote API in that case.

Having faced these problems more than once, I've made an image and compose for frontend developers that make it easy to proxy a remote backend locally.

Prerequisites

Things you need to use the software and how to install them.

  • docker
  • docker-compose (or docker with compose plugin)
  • OR NodeJS 16+

Installation and usage

Run CLI with npx

npx dev-backend-proxy -t https://jsonplaceholder.typicode.com -r https://jsonplaceholder.typicode.com -p 3001

Run with docker or NodeJS

  1. Clone repo
  1. Copy .env.example to .env
    cp .env.example .env
  2. Build and run docker-compose or use NodeJS
    docker-compose up -d --build
    Or with NodeJS
    npm install & npm run start
  3. Open http://localhost:3001/todos/ and see response from https://jsonplaceholder.typicode.com/todos/
  1. Replace environments for your purposes and repeat step 2
EnvDescription
PROXY_TOTarget
HOST_PORTWhere service should listen
REPLACED_ORIGINWhat origin we should use to replace Origin header
  1. PROFIT!

License

Distributed under the MIT License.