Created
August 20, 2025 14:01
-
-
Save anshajk/a5091211c4e33530742c9e14782dd31a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
app = FastAPI() | |
@app.get("/") | |
def read_root(): | |
return {"message": "Hello, FastAPI!"} | |
# Greet user by name | |
@app.get("/greet/{name}") | |
def greet_user(name: str): | |
return {"greeting": f"Hello, {name}!"} | |
# Add two numbers | |
@app.get("/add") | |
def add_numbers(a: int, b: int): | |
return {"result": a + b} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fastapi | |
uvicorn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment