Complete the code to import FastAPI from the correct package.
from [1] import FastAPI
You import FastAPI from the fastapi package to create your app.
Complete the code to create a FastAPI app instance.
app = [1]()You create an app by calling FastAPI().
Fix the error in the route decorator to define a GET endpoint at root path.
@app.[1]("/") def read_root(): return {"Hello": "World"}
The route decorator for a GET request is @app.get("/").
Fill both blanks to define a POST endpoint at path '/items' that accepts a parameter named 'item_id'.
@app.[1]("/items/{item_id}") async def create_item([2]: int): return {"item_id": item_id}
The POST decorator is @app.post and the function parameter must match the path variable name item_id.
Fill all three blanks to run the FastAPI app with uvicorn on host '127.0.0.1' and port 8000.
import uvicorn if __name__ == "__main__": uvicorn.run(app, host=[1], port=[2], log_level=[3])
To run locally, use host "127.0.0.1", port 8000, and log level "info" for standard output.
