Recall & Review
beginner
What command do you use to install FastAPI?
You use
pip install fastapi to install FastAPI.Click to reveal answer
beginner
Why do you also need to install an ASGI server like Uvicorn when using FastAPI?
FastAPI is a framework, but it needs an ASGI server like Uvicorn to run your app and handle web requests.
Click to reveal answer
beginner
What is the command to install Uvicorn with recommended extras?
You run
pip install "uvicorn[standard]" to install Uvicorn with useful extras for production.Click to reveal answer
beginner
How do you start a FastAPI app using Uvicorn from the command line?
Use
uvicorn main:app --reload where main is your Python file and app is your FastAPI instance. The --reload option restarts the server on code changes.Click to reveal answer
beginner
What is the minimal FastAPI app code to test your setup?
```python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"}
```Click to reveal answer
Which command installs FastAPI?
✗ Incorrect
FastAPI is installed using
pip install fastapi.What role does Uvicorn play in FastAPI setup?
✗ Incorrect
Uvicorn is an ASGI server that runs FastAPI apps and handles web requests.
What does the
--reload option do when running Uvicorn?✗ Incorrect
The
--reload option restarts the server automatically when you change your code.Which file and variable do you specify to run a FastAPI app with Uvicorn?
✗ Incorrect
You specify
main:app where main.py is the file and app is the FastAPI instance.What is the first step after installing FastAPI and Uvicorn to see your app running?
✗ Incorrect
You need to write a FastAPI app code before running it with Uvicorn.
Describe the steps to install and run a basic FastAPI app.
Think about installation, coding, and running the server.
You got /4 concepts.
Explain why you need both FastAPI and Uvicorn to run a web app.
One builds, the other runs.
You got /3 concepts.