Documentation
¶
Index ¶
- func DumpHttp(logLevel logger.Level) func(http.Handler) http.Handler
- func MiddlewareSequencer(baseHandler http.Handler, mws ...func(http.Handler) http.Handler) http.Handler
- func PanicCatcher(next http.Handler) http.Handler
- func Timer(logLevel logger.Level) func(http.Handler) http.Handler
- type Controller
- type Formatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MiddlewareSequencer ¶
func MiddlewareSequencer(baseHandler http.Handler, mws ...func(http.Handler) http.Handler) http.Handler
MiddlewareSequencer chains middleware functions in a chain.
func PanicCatcher ¶
PanicCatcher handles panics in http.HandlerFunc.
Types ¶
type Controller ¶
type Controller struct {
Server *http.Server
GracefulTimeout time.Duration
// contains filtered or unexported fields
}
Controller is a wrapper around *http.Server to control the server.
Server — *http.Server, which will be managed. GracefulTimeout — time that is given to the server to shut down gracefully.
func (*Controller) Restart ¶
func (c *Controller) Restart()
Restart restarts the server if necessary. For changes to the following parameters to take effect:
Addr; TLSConfig; TLSNextProto; ConnState; BaseContext; ConnContext,
a server restart is required. Other parameters can be changed without restarting the server. If the server is not running, the function will be skipped.
func (*Controller) Shutdown ¶
func (c *Controller) Shutdown()
Shutdown gracefully shuts down the server.
func (*Controller) Start ¶
func (c *Controller) Start() (err error)
Start starts the *http.Server. If *tls.Config on the server is non nil, the server listens and serves using tls.
Click to show internal directories.
Click to hide internal directories.