Add health check API, logging setup, and environment variable support; update requirements and .gitignore

This commit is contained in:
Mabe
2026-08-28 18:44:29 +02:00
parent 36cb2dc567
commit 79e0af79dc
9 changed files with 261 additions and 175 deletions
+26
View File
@@ -0,0 +1,26 @@
from fastapi import APIRouter
import logging
#Logging
logging.basicConfig(
filename='api.log', # Log to a file
level=logging.DEBUG, # Log everything (DEBUG and above)
format='%(asctime)s %(levelname)s %(message)s'
)
logging.info('Application started')
try:
logging.debug('Debug info here')
except Exception as e:
logging.exception('An error occurred')
router = APIRouter(prefix="/health", tags=["health"])
@router.get("/")
def health_check():
logging.info("get health check request")
return {"status": "ok"}