Starting FastAPI
# Import FastAPI framework
from fastapi import FastAPI
# Set up the App
app = FastAPI()
# Set up the path operation
@app.get("/")
async def root():
return {"message": "Hello World"}uvicorn main:app
# If you get an error that uvicorn is not valid use:
python -m uvicorn main:app --reloadINFO: Started server process [21240]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Last updated