apigear

package
v0.0.0-...-4fcfe31 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APICompositionFunc

type APICompositionFunc func(*machinery.Machinery) APIInfo

APICompositionFunc is the api root composition func in which specify API configuration. Here the developer can create its routes and manually dependency wire into controllers and services.2

type APIConf

type APIConf struct {
	Endpoint struct {
		Port            int
		BaseRoutingPath string
	}
	Security struct {
		Enabled bool
		Jwt     struct {
			Secret     string
			Expiration struct {
				Enabled bool
				Minutes int32
			}
		}
	}
}

APIConf is the API Gear configuration structure.

type APIGear

type APIGear struct {
	machinery.BaseGear
	// contains filtered or unexported fields
}

APIGear is the gear structure derived from the Machinery BaseGear.

func NewAPIGear

func NewAPIGear(uname string, compose APICompositionFunc) *APIGear

NewAPIGear creates a new APIGear instance.

func (*APIGear) Configure

func (apigear *APIGear) Configure(config interface{})

Configure get the configuration map and struct it into APIConf structure.

func (*APIGear) Shutdown

func (apigear *APIGear) Shutdown()

Shutdown .

func (*APIGear) Start

func (apigear *APIGear) Start(machine *machinery.Machinery)

Start will start the APIGear runtime. It creates the root api router, setup middelwares and mount the app routing.

func (*APIGear) Use

func (apigear *APIGear) Use(middlewares ...func(http.Handler) http.Handler)

Use setup middlewares.

type APIInfo

type APIInfo struct {
	Router      *chi.Mux
	Middlewares []func(http.Handler) http.Handler
}

APIInfo is the structure returned by the starter func. These params will be used by the APIGear to start the http server.

Jump to

Keyboard shortcuts

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