Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Module = fx.Options(fx.Invoke(func(p params) error { httpServer := &http.Server{ Addr: string(p.Addr), WriteTimeout: 30 * time.Second, ReadTimeout: 30 * time.Second, IdleTimeout: 30 * time.Second, Handler: http.TimeoutHandler(p.Router, 30*time.Second, "server timeout"), } log := p.Logger.Named("http-server") p.Lifecycle.Append(fx.Hook{ OnStart: func(context.Context) error { go func() { log.Infow("starting http-server...", "addr", string(p.Addr)) shutdownStatus := httpServer.ListenAndServe() log.Infow("http-server was started", "status", shutdownStatus) _ = p.Shutdowner.Shutdown() }() return nil }, OnStop: func(ctx context.Context) error { log.Infow("http-server is stopping...") return httpServer.Shutdown(ctx) }, }) return nil }))
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.