diff --git a/app/main.py b/app/main.py index 1c3b757..488b652 100644 --- a/app/main.py +++ b/app/main.py @@ -2,13 +2,14 @@ Main module to run the FastAPI application which is called by uvicorn. """ +import rich from fastapi import FastAPI from app import config from app.routers import users settings = config.Settings() -print(settings.model_dump()) +rich.print(f"configuration: {settings.model_dump()}") app = FastAPI(debug=settings.http.debug) diff --git a/main.py b/main.py new file mode 100644 index 0000000..0f00681 --- /dev/null +++ b/main.py @@ -0,0 +1,24 @@ +import typer +import uvicorn + +app = typer.Typer() + + +@app.command() +def serve(port: int = 1378, debug: bool = False): + print(f"FastAPI101 is coming up 0.0.0.0:{port}") + uvicorn.run( + "app.main:app", + host="0.0.0.0", + port=port, + reload=debug, + workers=5, + backlog=1024, + log_level="debug" if debug else "info", + use_colors=True, + access_log=debug, + ) + + +if __name__ == "__main__": + app()