MCPcopy Create free account
hub / github.com/vercel/vercel / _start_asgi

Function _start_asgi

python/vercel-runtime/src/vercel_runtime/dev.py:361–388  ·  view source on GitHub ↗
(host: str, port: int)

Source from the content-addressed store, hash-verified

359
360
361def _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
391def _setup_apps() -> None:

Callers 1

mainFunction · 0.85

Calls 6

is_cron_serviceFunction · 0.90
is_worker_serviceFunction · 0.90
runMethod · 0.65
exitMethod · 0.45

Tested by

no test coverage detected