App Lifecycle
Last updated
Was this helpful?
Last updated
Was this helpful?
Copper provides an "App Container" that runs your application code. This container manages the app lifecycle i.e. running code during startup (ex. opening database connections) and shutdown (ex. closing database connections). It also listens to interrupt signals so it can allow for a graceful shutdown of the app.
The copper.App
struct, returned by copper.New()
contains a pre-configured , , and the app lifecycle manager - that you can use to add custom logic on app startup & shutdown.
To run cleanup code when your app is shutting down, register the function using the app lifecycle -