awesome-python
awesome-python copied to clipboard
Add FastAPI example main.py witha simple GET endpoint
Added main.py as a simple FastAPI example demonstrating a basic GET endpoint.
The application defines a single route ("/") that returns a JSON message: { "message": "Hello, FastAPI!" }
This serves as a quick-start example for beginners to understand how to:
- Initialize a FastAPI app
- Define a GET endpoint
- Run it locally using Uvicorn
To run this example:
-
Install dependencies: pip install fastapi uvicorn
-
Run the app: uvicorn main:app --reload
-
Open in your browser: http://127.0.0.1:8000/