App Lifecycle
Cleanup Code
func NewServer(lc *clifecycle.Lifecycle) *Server {
myServer := &Server{..}
// Stop the server when the app is shutting down..
lc.OnStop(func(ctx context.Context) error {
return myServer.Stop(ctx)
})
return myServer
}Last updated