This folder contains the practical work for Module 1 of the FastAPI tutorial series. The exercises and examples here introduce the basics of building backend applications using FastAPI and Python.
-
Create a virtual environment:
python -m venv .venv
Activate the virtual environment:
- On macOS/Linux:
source .venv/bin/activateOn Windows use
.venv\Scripts\activate -
Install dependencies:
pip install fastapi uvicorn
-
Create a file named
main.pyand add the following code:from fastapi import FastAPI app = FastAPI() # Hello FastAPI Project @app.get("/") def read_root(): return {"message": "Hello, FastAPI!"}
-
Run the FastAPI app:
uvicorn main:app --reload
-
Open your browser at http://127.0.0.1:8000 to access the API.
- Understand FastAPI project structure
- Create basic API endpoints
- Run and test a FastAPI application
For more information, see the FastAPI documentation.