simproxy

command module
v0.0.0-...-58db004 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 7 Imported by: 0

README

Build Status GoDoc Go Report Card

About the project

The project is an example of an application that uses reverse proxy from the standartd library.

Why

Let's assume you want to migrate your api from language X to golang. Sometimes it's hard to rewrite everything at once and you want to move some handlers to golang, but use old application as a fallback. I just want to show you that you don't have to use any 3rd-party proxies (like nginx) or write your own proxy logic.

How to use it

The solution is quite simple and straightforward. We use reverse proxy and http server from the standard library.

  • Clone or go get -u github.com/beono/simproxy this project.
  • Run go test && go run main.go to see it in action.

Send a request to http://localhost/hello and you will get a tiny text response.

Send a request to http://localhost:8080/oauth2/v3/certs and you will get a json response. This request was proxied to https://www.googleapis.com/oauth2/v3/certs, because this handler doesn't exist in our new application.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL