1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-04 15:35:26 +02:00
tldr/pages/common/fastapi.md

29 lines
708 B
Markdown
Raw Normal View History

2025-06-29 22:12:37 +05:30
# fastapi
2025-06-29 22:22:45 +05:30
> CLI tool to run FastAPI apps which uses Uvicorn under the hood.
2025-06-29 22:12:37 +05:30
> More information: <https://fastapi.tiangolo.com/tutorial/cli/>.
- Run a FastAPI app with automatic reload (for development):
`fastapi run {{main.py}} --reload`
- Serve your app in both development or production mode using the `dev` command:
`fastapi dev {{main.py}}`
- Specify the host and port to run on:
`fastapi run {{main.py}} --host {{0.0.0.0}} --port {{8000}}`
- Set the app variable name (if not `app`) or specify a custom app directory:
`fastapi run {{main.py}} --app-dir {{path/to/app}} --app {{custom_app_name}}`
- Display global help:
`fastapi --help`
- Display help for a subcommand:
`fastapi run --help`