Documentation ¶
Overview ¶
Package rest contains code for running the REST-to-gRPC gateway.
In order to add a new REST endpoint, add an entry to `gateway/rest/grpc-rest-bindings.yml`.
Run `make proto` to generate (among others) the swagger json file.
Run `make rest_check` to make sure that all the endpoints in the bindings yaml file make it into the swagger json file.
Index ¶
- func NewGzipHandler(logger logging.Logger, fn http.HandlerFunc) http.HandlerFunc
- type JSONPb
- func (*JSONPb) ContentType(interface{}) string
- func (j *JSONPb) Delimiter() []byte
- func (j *JSONPb) Marshal(v interface{}) ([]byte, error)
- func (j *JSONPb) NewDecoder(r io.Reader) runtime.Decoder
- func (j *JSONPb) NewEncoder(w io.Writer) runtime.Encoder
- func (j *JSONPb) Unmarshal(data []byte, v interface{}) error
- type ProxyServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGzipHandler ¶ added in v0.57.0
func NewGzipHandler(logger logging.Logger, fn http.HandlerFunc) http.HandlerFunc
Types ¶
type JSONPb ¶
JSONPb is a runtime.Marshaler which marshals/unmarshals into/from.
func (*JSONPb) ContentType ¶
ContentType always returns "application/json".
func (*JSONPb) NewDecoder ¶
NewDecoder returns a runtime.Decoder which reads JSON stream from "r".
func (*JSONPb) NewEncoder ¶
NewEncoder returns an Encoder which writes JSON stream into "w".
type ProxyServer ¶
ProxyServer implement a rest server acting as a proxy to the grpc api.
func NewProxyServer ¶
func NewProxyServer(log *logging.Logger, config gateway.Config) *ProxyServer
NewProxyServer returns a new instance of the rest proxy server.
func (*ProxyServer) ReloadConf ¶
func (s *ProxyServer) ReloadConf(cfg gateway.Config)
ReloadConf update the internal configuration of the server.