http

package
v0.0.0-...-e510c16 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: MIT Imports: 5 Imported by: 0

README

HTTP server

Simple http server wrapper helper

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServerClosed = http.ErrServerClosed

Functions

func MaxBytesReader

func MaxBytesReader(bytes int64) func(handler http.Handler) http.Handler

func ServerAddr

func ServerAddr(addr string) func(server *Server)

ServerAddr adds server listening port

func ServerLogger

func ServerLogger(l logrus.FieldLogger) func(server *Server)

ServerLogger adds logger to server

func ServerReadTimout

func ServerReadTimout(duration time.Duration) func(server *Server)

ServerLogger adds read timeout for server

func ServerRouter

func ServerRouter(r chi.Router) func(server *Server)

ServerRouter adds router to server

func ServerWriteTimeout

func ServerWriteTimeout(duration time.Duration) func(server *Server)

ServerLogger adds write timeout for server

Types

type Server

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

func NewServer

func NewServer(options ...func(s *Server)) *Server

func (*Server) Delete

func (s *Server) Delete(pattern string, f func(w http.ResponseWriter, r *http.Request))

func (*Server) Get

func (s *Server) Get(pattern string, f func(w http.ResponseWriter, r *http.Request))

func (*Server) Post

func (s *Server) Post(pattern string, f func(w http.ResponseWriter, r *http.Request))

func (*Server) Put

func (s *Server) Put(pattern string, f func(w http.ResponseWriter, r *http.Request))

func (*Server) Shutdown

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

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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