Skip to content

Commit ea52043

Browse files
Merge pull request #11 from goldlabelapps/staging
Remove inline root, health, and echo routes
2 parents c70a34a + d749521 commit ea52043

1 file changed

Lines changed: 0 additions & 44 deletions

File tree

app/api/routes.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,3 @@
2222
router.include_router(health_router)
2323
router.include_router(echo_router)
2424

25-
26-
27-
28-
29-
@router.get("/")
30-
def root(conn=Depends(get_db_connection)) -> dict:
31-
"""Return a structured welcome message for the API root, including product data."""
32-
cur = conn.cursor()
33-
try:
34-
cur.execute('SELECT id, name, description, price, in_stock, created_at FROM product;')
35-
products = [
36-
{
37-
"id": row[0],
38-
"name": row[1],
39-
"description": row[2],
40-
"price": str(row[3]) if row[3] is not None else None,
41-
"in_stock": row[4],
42-
"created_at": row[5].isoformat() if row[5] else None,
43-
}
44-
for row in cur.fetchall()
45-
]
46-
finally:
47-
cur.close()
48-
epoch = int(time.time() * 1000)
49-
meta = {
50-
"version": __version__,
51-
"time": time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()),
52-
"epoch": epoch,
53-
"severity": "success",
54-
"message": f"NX AI says hello. Returned {len(products)} products.",
55-
}
56-
return {"meta": meta, "data": products}
57-
58-
59-
@router.get("/health")
60-
def health() -> dict[str, str]:
61-
"""Return the health status of the application."""
62-
return {"status": "ok"}
63-
64-
65-
@router.post("/echo", response_model=EchoResponse)
66-
def echo(body: EchoRequest) -> EchoResponse:
67-
"""Echo the provided message back to the caller."""
68-
return EchoResponse(echo=body.message)

0 commit comments

Comments
 (0)