web

package
v0.0.0-...-55591ee Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFExempt

func CSRFExempt(globs ...string)

func Dropper

func Dropper(paths ...string) func(next http.Handler) http.Handler

func LogWith

func LogWith(ctx context.Context, keyvals ...interface{})

LogWith adds keyvals to the logger's fields.

func Nosurfing

func Nosurfing(h http.Handler) http.Handler

func Respond

func Respond(r *http.Request) *render.Render

func SocketOnly

func SocketOnly(next http.Handler) http.Handler

func WithRender

func WithRender(ren *render.Render) func(next http.Handler) http.Handler

Types

type OptionFunc

type OptionFunc func(*Server) error

func (OptionFunc) Apply

func (of OptionFunc) Apply(s *Server) error

type Optioner

type Optioner interface {
	Apply(*Server) error
}

type Server

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

func NewServer

func NewServer(options ...Optioner) (*Server, error)

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown the server with a timeout from the given context.

func (*Server) Start

func (s *Server) Start(ln net.Listener) error

Start the server listening on the given listener. This will not block and will continue to service requests untill the listener closes or there is a call to Shutdown.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context, ln net.Listener) error

Jump to

Keyboard shortcuts

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