Running the FastAPI application asynchronously is made possible with Uvicorn. Uvicorn is an ASGI (Asynchronous Server Gateway Interface) server that provides a fast and efficient way to serve FastAPI applications.
Uvicorn is a lightweight ASGI server that allows FastAPI applications to take full advantage of asynchronous programming. It is designed to deliver high performance and is particularly well-suited for applications with high concurrency.
-
Asynchronous Support: Uvicorn fully supports asynchronous programming, allowing FastAPI to handle many requests concurrently without blocking.
-
Automatic Reloading: The
--reloadoption, as used in the command below, enables automatic reloading of the server during development, making the development process smoother.
To start the FastAPI application asynchronously using Uvicorn, follow these steps:
poetry run uvicorn src.main:app --reloadThis command launches the FastAPI application, enabling asynchronous functionality with automatic reloading during development.
For more details and advanced configuration options when running the backend with Uvicorn, refer to the Uvicorn Documentation.