http

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Writer      http.ResponseWriter
	Request     *http.Request
	Route       *Route
	RouteParams []string

	Aborted       bool
	HeaderWritten bool
	// contains filtered or unexported fields
}

func MakeContext

func MakeContext(writer http.ResponseWriter, request *http.Request) *Context

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithStatus

func (c *Context) AbortWithStatus(status int)

func (*Context) Get

func (c *Context) Get(key string) interface{}

func (*Context) JSON

func (c *Context) JSON(status int, data interface{})

func (*Context) Set

func (c *Context) Set(key string, value interface{})

type Decorator

type Decorator func(*Route) Handler

type H

type H map[string]interface{}

type HTTPServer

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

func MakeHTTPServer

func MakeHTTPServer(settings *services.HTTPServerSettings, routeGroups []*RouteGroup, metricsPrefix string) (*HTTPServer, error)

func (*HTTPServer) AddRouteGroups added in v0.0.6

func (s *HTTPServer) AddRouteGroups(routeGroups []*RouteGroup) error

func (*HTTPServer) ServeHTTP

func (s *HTTPServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*HTTPServer) SetHooks

func (h *HTTPServer) SetHooks(hooks *Hooks)

func (*HTTPServer) SetListener

func (h *HTTPServer) SetListener(listener net.Listener)

func (*HTTPServer) SetTLSConfig

func (h *HTTPServer) SetTLSConfig(config *cryptoTls.Config)

func (*HTTPServer) Start

func (s *HTTPServer) Start() error

func (*HTTPServer) Stop

func (s *HTTPServer) Stop() error

type Handler

type Handler func(*Context)

type Hooks

type Hooks struct {
	Finished Handler
}

type Route

type Route struct {
	Pattern  string
	Regexp   *regexp.Regexp
	Handlers []Handler
}

type RouteGroup

type RouteGroup struct {
	Routes    []*Route
	Handlers  []Handler
	Subgroups []*RouteGroup
}

Jump to

Keyboard shortcuts

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