Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
These functions can be declared with `async def` or normal `def`.
+!!! warning
+ Only event handlers for the main application will be executed, not for [Sub Applications - Mounts](./sub-applications.md){.internal-link target=_blank}.
+
## `startup` event
To add a function that should be run before the application starts, declare it with the event `"startup"`:
So, we declare the event handler function with standard `def` instead of `async def`.
!!! info
- You can read more about these event handlers in <a href="https://www.starlette.io/events/" class="external-link" target="_blank">Starlette's Events' docs</a>.
\ No newline at end of file
+ You can read more about these event handlers in <a href="https://www.starlette.io/events/" class="external-link" target="_blank">Starlette's Events' docs</a>.