Documentation ¶
Index ¶
- func ListenAndServe(ctx context.Context, addr string, handler http.Handler, ...) error
- func ListenAndServeServer(ctx context.Context, s *http.Server, shutdownContext ContextFunc) error
- func ListenAndServeTLS(ctx context.Context, addr string, certFile string, keyFile string, ...) error
- func ListenAndServeTLSServer(ctx context.Context, s *http.Server, certFile string, keyFile string, ...) error
- type ContextFunc
- type MethodHandler
- type ServeMux
- func (m *ServeMux) Handle(pattern string, handler http.Handler, middlewares ...middleware.Middleware)
- func (m *ServeMux) HandleFunc(pattern string, handler http.HandlerFunc, middlewares ...middleware.Middleware)
- func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *ServeMux) UseMiddleware(middlewares ...middleware.Middleware)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
func ListenAndServe(ctx context.Context, addr string, handler http.Handler, shutdownContext ContextFunc) error
ListenAndServe is run http.ListenAndServe and cancellation by context.Context.
func ListenAndServeServer ¶
ListenAndServeServer is run http.Server.ListenAndServe and cancellation by context.Context.
func ListenAndServeTLS ¶
func ListenAndServeTLS(ctx context.Context, addr string, certFile string, keyFile string, handler http.Handler, shutdownContext ContextFunc) error
ListenAndServeTLS is run http.ListenAndServeTLS and cancellation by context.Context.
func ListenAndServeTLSServer ¶
func ListenAndServeTLSServer(ctx context.Context, s *http.Server, certFile string, keyFile string, shutdownContext ContextFunc) error
ListenAndServeTLSServer is run http.Server.ListenAndServeTLS and cancellation by context.Context.
Types ¶
type ContextFunc ¶
type ContextFunc func() (context.Context, context.CancelFunc)
ContextFunc is factory of context.Context.
type MethodHandler ¶
type MethodHandler struct { GET http.Handler // HTTP GET HEAD http.Handler // HTTP HEAD POST http.Handler // HTTP POST PUT http.Handler // HTTP PUT PATCH http.Handler // HTTP PATCH DELETE http.Handler // HTTP DELETE CONNECT http.Handler // HTTP CONNECT OPTIONS http.Handler // HTTP OPTIONS TRACE http.Handler // HTTP TRACE Default http.Handler // Default handler }
MethodHandler is router by HTTP method.
func (*MethodHandler) ServeHTTP ¶
func (h *MethodHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is implementation of http.Handler.
type ServeMux ¶
type ServeMux struct {
// contains filtered or unexported fields
}
ServeMux is an HTTP request multiplexer.
func (*ServeMux) Handle ¶
func (m *ServeMux) Handle(pattern string, handler http.Handler, middlewares ...middleware.Middleware)
Handle registers the handler for the given pattern. Middlewares is processed after registered middleware by UseMiddleware and process before handlers are executed. If a handler already exists for pattern, Handle panics.
func (*ServeMux) HandleFunc ¶
func (m *ServeMux) HandleFunc(pattern string, handler http.HandlerFunc, middlewares ...middleware.Middleware)
HandleFunc registers the handler function for the given pattern. Middlewares is processed after registered middleware by UseMiddleware and process before handlers are executed.
func (*ServeMux) ServeHTTP ¶
func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is implementation of http.Handler.
func (*ServeMux) UseMiddleware ¶
func (m *ServeMux) UseMiddleware(middlewares ...middleware.Middleware)
UseMiddleware is register middleware. Middleware is processed before all handlers are executed.