http

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

type Route struct {
	Method  string
	Path    string
	Handler http.HandlerFunc
}

type Router

type Router struct {
	Handler *httprouter.Router
}

func NewRouter

func NewRouter() *Router

func (*Router) AddRoutes

func (r *Router) AddRoutes(routes []Route)

func (*Router) SetMethodNotAllowed

func (r *Router) SetMethodNotAllowed(handler http.Handler)

func (*Router) SetNotFound

func (r *Router) SetNotFound(handler http.Handler)

type Server

type Server struct {
	HTTP *http.Server
}

func NewServer

func NewServer(config ServerConfig, handler http.Handler) *Server

func (*Server) AddMiddleware

func (s *Server) AddMiddleware(middleware func(http.Handler) http.Handler)

AddMiddleware allows server level middleware chaining. The first middleware in the chain runs last. Server level middleware always take precedence over router level middleware.

type ServerConfig

type ServerConfig struct {
	Host string
	Port string
}

Jump to

Keyboard shortcuts

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