mirror of https://github.com/vapor/docs.git
Extend lifecycle handler example (#843)
Server lifecycle has been extended with `didBoot` and `shutdown` events. Extend lifecycle handler example.
This commit is contained in:
parent
f6b4271e69
commit
871eab9b96
|
|
@ -82,6 +82,16 @@ struct Hello: LifecycleHandler {
|
|||
func willBoot(_ app: Application) throws {
|
||||
app.logger.info("Hello!")
|
||||
}
|
||||
|
||||
// Called after application boots.
|
||||
func didBoot(_ app: Application) throws {
|
||||
app.logger.info("Server is running")
|
||||
}
|
||||
|
||||
// Called before application shutdown.
|
||||
func shutdown(_ app: Application) {
|
||||
app.logger.info("Goodbye!")
|
||||
}
|
||||
}
|
||||
|
||||
// Add lifecycle handler.
|
||||
|
|
|
|||
|
|
@ -81,6 +81,16 @@ struct Hello: LifecycleHandler {
|
|||
func willBoot(_ app: Application) throws {
|
||||
app.logger.info("Hello!")
|
||||
}
|
||||
|
||||
// Wordt aangeroepen nadat de applicatie is opgestart.
|
||||
func didBoot(_ app: Application) throws {
|
||||
app.logger.info("Server is running")
|
||||
}
|
||||
|
||||
// Wordt aangeroepen voordat de applicatie wordt afgesloten.
|
||||
func shutdown(_ app: Application) {
|
||||
app.logger.info("Goodbye!")
|
||||
}
|
||||
}
|
||||
|
||||
// Voeg levenscyclus handler toe.
|
||||
|
|
|
|||
|
|
@ -81,6 +81,16 @@ struct Hello: LifecycleHandler {
|
|||
func willBoot(_ app: Application) throws {
|
||||
app.logger.info("Hello!")
|
||||
}
|
||||
|
||||
// 应用程序启动后调用。
|
||||
func didBoot(_ app: Application) throws {
|
||||
app.logger.info("Server is running")
|
||||
}
|
||||
|
||||
// 在应用程序关闭前调用。
|
||||
func shutdown(_ app: Application) {
|
||||
app.logger.info("Goodbye!")
|
||||
}
|
||||
}
|
||||
|
||||
// 添加生命周期处理程序。
|
||||
|
|
|
|||
Loading…
Reference in New Issue