Protocol
LifecycleHandler
Provides a way to hook into lifecycle events of a Vapor application. You can register your handlers with the
Application to be notified when the application is about to start up, has started up and is about to shutdownprotocol LifecycleHandler : Sendable
Overview
For example
struct LifecycleLogger: LifecycleHander {
func willBoot(_ application: Application) async throws {
application.logger.info("Application about to boot up")
}
func didBoot(_ application: Application) async throws {
application.logger.info("Application has booted up")
}
func shutdown(_ application: Application) async {
application.logger.info("Will shutdown")
}
}
You can then register your handler with the application:
application.lifecycle.use(LifecycleLogger())
Topics
Instance Methods
func didBoot(Application) async throwsCalled when the application has booted upfunc shutdown(Application) asyncCalled when the application is about to shutdownfunc willBoot(Application) async throwsCalled when the application is about to boot up
Relationships
Inherits From
Swift.SendableSwift.SendableMetatype