logo

... fastapi: hello world



Notes

Before you can use it, you'll need to install the dependencies.

pip install fastapi uvicorn

From here, this is all we have in our app.py file.

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def root():
    return {"message": "hello world again"}

To start the server locally you need to run;

uvicorn app:app --reload

If you don't pass the --reload flag then the app won't restart when you update.

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.