gateway

package
v0.0.0-...-e74b3af Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Backend *url.URL
	Config  *config.EndpointConfig
}

Endpoint data type A slice of instances of this type comprise the entire gateway

func NewEndpoint

func NewEndpoint(conf *config.EndpointConfig) Endpoint

NewEndpoint creates an instance of type Endpoint and initiates it with the necessary configuration

func (*Endpoint) Build

func (e *Endpoint) Build(r *httprouter.Router) *Endpoint

Build the functionality for the endpoint

type Gateway

type Gateway struct {
	Router    *httprouter.Router
	Config    *config.Config
	Endpoints []*Endpoint
}

Gateway type encapsulates all data, config and methods required for the API gteway to function. If using Hodor as a library in your own go project, just import the gateway package and create an instance of type Gateway. Then call the Build and Start methods on that instance to start using the gateway.

func (*Gateway) Build

func (g *Gateway) Build(conf *config.Config) *Gateway

Build method associates the gateway's config, sets up the router, and configures individual end points.

func (*Gateway) Start

func (g *Gateway) Start()

Start method starts the http server using the router setup from the Build method.

Jump to

Keyboard shortcuts

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