Versions in this module Expand all Collapse all v1 v1.0.9 Sep 11, 2020 v1.0.8 Sep 11, 2020 Changes in this version + const DefaultMaxHeaderBytes + const ErrCodeBadRequest + const ErrCodeInvalidError + const ErrCodeOK + const ErrCodeServerPanic + func AddRoutes(routes Routes) + func Error(code int, msg string, errs ...error) error + func OnStart(hook Hook) + func Shutdown(ctx context.Context) error + type Config struct + Addr string + Debug bool + IdleTimeout time.Duration + MaxHeaderBytes int + PingURI string + ReadHeaderTimeout time.Duration + ReadTimeout time.Duration + WriteTimeout time.Duration + type Handler interface + type Hook func(ctx context.Context, s *Server) error + type Method string + const ANY + const DELETE + const GET + const HEAD + const OPTIONS + const PATCH + const POST + const PUT + func (m Method) String() string + type Route struct + Handlers []Handler + Method Method + URI string + func R(uri string, method Method, handlers ...Handler) *Route + type RouteList []*Route + func (rl RouteList) Register(router Router) error + type RouteMap map[string]Routes + func (rm RouteMap) Register(router Router) error + type Router interface + Handle func(method Method, uri string, handlers ...Handler) error + HandleAny func(uri string, handlers ...Handler) error + SubRouter func(uri string, handlers ...Handler) (Router, error) + type Routes interface + Register func(router Router) error + type Server struct + func New(config *Config) *Server + func (s *Server) AddRoutes(routes Routes) error + func (s *Server) Handler() http.Handler + func (s *Server) MustAddRoutes(routes Routes) + func (s *Server) Serve() error + func (s *Server) Shutdown(ctx context.Context) error