Update app.py
added product endpoint
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
from fastapi import FastAPI
|
||||
import json
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.get("/")
|
||||
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
|
||||
Reference in New Issue
Block a user