-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroot.py
More file actions
29 lines (27 loc) · 834 Bytes
/
root.py
File metadata and controls
29 lines (27 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from app import __version__
from fastapi import APIRouter
import os, time
from dotenv import load_dotenv
from app import __version__
router = APIRouter()
@router.get("/")
def root() -> dict:
"""Return product data."""
load_dotenv()
base_url = os.getenv("BASE_URL", "http://localhost:8000")
epoch = int(time.time() * 1000)
meta = {
"title": "NX-AI says hi",
"description": "This is the base_url",
"version": __version__,
"base_url": base_url,
"time": epoch,
"severity": "success",
"message": "Welcome to NX AI!"
}
endpoints = [
{"docs": "docs", "url": f"{base_url}/docs"},
{"name": "health", "url": f"{base_url}/health"},
{"name": "products", "url": f"{base_url}/products"}
]
return {"meta": meta, "data": endpoints}