Update app.py

added product endpoint
This commit is contained in:
2026-09-08 17:06:26 +00:00
parent 75920994e8
commit c0292a63f3
+7
View File
@@ -1,7 +1,14 @@
from fastapi import FastAPI from fastapi import FastAPI
import json
app = FastAPI() app = FastAPI()
@app.get("/") @app.get("/")
def home(): def home():
return {"message": "Welcome to DemoTel Product Catalog"} return {"message": "Welcome to DemoTel Product Catalog"}
@app.get("/products")
def get_products():
with open("products.json", "r") as file:
products = json.load(file)
return products