All Projects → poteto → reverse_proxy

poteto / reverse_proxy

Licence: other
Terraform demo - incrementally replace your API with Phoenix

Programming Languages

javascript
184084 projects - #8 most used programming language
elixir
2628 projects

ReverseProxy

What is this?

Terraform is a simple Plug that intercepts requests to missing routes, and forwards them along to somewhere else of your choosing. The main use-case for this is to incrementally replace an API with Phoenix.

Demo

mix do deps.get, deps.compile
iex -S mix phoenix.server

Try to do a GET to localhost:4000/v1/{foo,bar,baz} – they should work as normal.

Then, try a GET to localhost:4000/v1/gifs/search?q=funny+cat&api_key=dc6zaTOxFJmzC – this should forward the request to Giphy's public API and respond accordingly with funny cats.

You can also try a GET to localhost:4000/v1/hello-world, which is an example of directly matching a request by path.

Setup

To start your Phoenix app:

  • Install dependencies with mix deps.get
  • Start Phoenix endpoint with mix phoenix.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].