dev-backend-proxy
v1.0.9
Published
Proxy remote backend for local development with CORS and Cookies
Maintainers
Readme
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 3001Run with docker or NodeJS
Clone repo
Copy .env.example to .env
cp .env.example .envBuild and run docker-compose or use NodeJS
docker-compose up -d --buildOr with NodeJS
npm install & npm run startOpen http://localhost:3001/todos/ and see response from https://jsonplaceholder.typicode.com/todos/
Replace environments for your purposes and repeat step 2
| Env | Description | |-----------------|----------------------------------------------------| | PROXY_TO | Target | | HOST_PORT | Where service should listen | | REPLACED_ORIGIN | What origin we should use to replace Origin header |
- PROFIT!
License
Distributed under the MIT License.
