(host: str, port: int)
| 359 | |
| 360 | |
| 361 | def _start_asgi(host: str, port: int) -> None: |
| 362 | # Prefer user-installed fastapi-cli for web services; |
| 363 | # cron/worker go straight to uvicorn. |
| 364 | if not is_cron_service() and not is_worker_service(): |
| 365 | try: |
| 366 | from fastapi_cli.cli import ( # noqa: PLC0415 # pyright: ignore[reportMissingImports] |
| 367 | dev as fastapi_dev, # pyright: ignore[reportUnknownVariableType] |
| 368 | ) |
| 369 | |
| 370 | _patch_fastapi_cli_log_config() |
| 371 | fastapi_dev( |
| 372 | entrypoint="vercel_runtime.dev:asgi_app", |
| 373 | host=host, |
| 374 | port=port, |
| 375 | reload=True, |
| 376 | ) |
| 377 | sys.exit(0) |
| 378 | except (ImportError, AttributeError): |
| 379 | pass |
| 380 | |
| 381 | vendored_uvicorn.run( |
| 382 | "vercel_runtime.dev:asgi_app", |
| 383 | host=host, |
| 384 | port=port, |
| 385 | use_colors=not _NO_COLOR, |
| 386 | reload=True, |
| 387 | log_config=_build_uvicorn_log_config(), |
| 388 | ) |
| 389 | |
| 390 | |
| 391 | def _setup_apps() -> None: |
no test coverage detected