1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-30 10:10:44 +02:00
go-micro/plugins/proxy/http
Jerry 93ba8cd0df
continue fix pre version go get bug that unknown v3.5.1 (#2188)
* 1.fix plugins go get bug.
2.update all mode.
3.add tidy tools

* continue fix pre version go get bug that unknown v3.5.1
2021-06-30 09:24:00 +01:00
..
go.mod continue fix pre version go get bug that unknown v3.5.1 (#2188) 2021-06-30 09:24:00 +01:00
go.sum 1.fix plugins go get bug. (#2187) 2021-06-30 07:21:03 +01:00
http_test.go update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00
http.go update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00
options.go update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00
README.md add all the plugins 2020-12-26 15:32:45 +00:00

HTTP Proxy

This is a http proxy plugin which converts RPC to HTTP request

Overview

NewService returns a new http proxy. It acts as a micro service and proxies to a http backend. Routes are dynamically set e.g Foo.Bar routes to /foo/bar. The default backend is http:localhost:9090. Optionally specify the backend endpoint url or the router. Also choose to register specific endpoints.

Usage

service := NewService(
      micro.Name("greeter"),
      // Sets the default http endpoint
      http.WithBackend("http:localhost:10001"),
)

// Set fixed backend endpoints
// register an endpoint
http.RegisterEndpoint("Hello.World", "/helloworld")

service := NewService(
      micro.Name("greeter"),
      // Set the http endpoint
      http.WithBackend("http:localhost:10001"),
)