gonzo

package
v0.0.0-...-8515840 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLogger

type AccessLogger struct {
	// contains filtered or unexported fields
}

* Handle principal calls

func (AccessLogger) ServeHTTP

func (p AccessLogger) ServeHTTP(w http.ResponseWriter, r *http.Request, c *Context)

Wrap the request with access logging

type Context

type Context struct {
	// contains filtered or unexported fields
}

func (*Context) NamedPath

func (p *Context) NamedPath(key string) string

Get a named path in the Handler definition

func (*Context) Principal

func (p *Context) Principal() string

The principal handler, when set

func (Context) ServeHTTP

func (p Context) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ContextHandler

type ContextHandler func(http.ResponseWriter, *http.Request, *Context)

type MicroService

type MicroService struct {
	Health func(w http.ResponseWriter, r *http.Request, c *Context)
	// contains filtered or unexported fields
}

func NewMicroService

func NewMicroService() *MicroService

Instantiate a new microservice

func (*MicroService) Handle

func (m *MicroService) Handle(method string, path string, handler ContextHandler)

Wrap a Handler with AccessLogger and Principal

func (*MicroService) NotAllowed

func (ms *MicroService) NotAllowed(method string, path string)

Handle: Not Allowed Requests

func (*MicroService) Principal

func (m *MicroService) Principal(method string, path string, handler ContextHandler)

Wrap a Handler with AccessLogger and Principal

func (*MicroService) Start

func (ms *MicroService) Start()

Start a microservice with default health page. It uses port 8080 by convention.

func (*MicroService) StartOnPort

func (ms *MicroService) StartOnPort(port int)

Start a microservice with default health page on the given port

type Principal

type Principal struct {
	// contains filtered or unexported fields
}

func (Principal) ServeHTTP

func (p Principal) ServeHTTP(w http.ResponseWriter, r *http.Request, c *Context)

Jump to

Keyboard shortcuts

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