added database connection

This commit is contained in:
Hosein
2025-12-26 11:17:52 +03:30
parent b4c3ad40dc
commit b16ed91822
7 changed files with 140 additions and 34 deletions
-30
View File
@@ -43,36 +43,6 @@ async def telegram_webhook(request: Request):
return JSONResponse(content={"ok": True}, status_code=200)
@app.post("/api/test")
async def test():
return {"message": "Test successful"}
@app.get("/api/data")
def get_sample_data():
return {
"data": [
{"id": 1, "name": "Sample Item 1", "value": 100},
{"id": 2, "name": "Sample Item 2", "value": 200},
{"id": 3, "name": "Sample Item 3", "value": 300}
],
"total": 3,
"timestamp": "2024-01-01T00:00:00Z"
}
@app.get("/api/items/{item_id}")
def get_item(item_id: int):
return {
"item": {
"id": item_id,
"name": "Sample Item " + str(item_id),
"value": item_id * 100
},
"timestamp": "2024-01-01T00:00:00Z"
}
@app.get("/", response_class=HTMLResponse)
def read_root():
return """<!DOCTYPE html>