File size: 759 Bytes
d3530f3
 
19d49a8
d3530f3
 
42cffde
 
d3530f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee409a4
d3530f3
ee409a4
 
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
from fastapi import FastAPI, Request, HTTPException


from src.routers.public.public import router
from src.utils.response import handler_error
from src.services.AI.false_ans_generator import FalseAnswerGenerator

    
app = FastAPI()
@app.exception_handler(Exception)
async def exception_handler(request: Request, exc: Exception):
    return handler_error(exc)

@app.exception_handler(HTTPException)
async def http_exception_handler(request: Request, exc: HTTPException):
    return handler_error(exc)

@app.get('/check-health')
def check_health():
    return {"status": "ok"}

app.include_router(router)

if __name__ == "__main__":
    import os
    import uvicorn
    port = int(os.environ.get("PORT", 8000))
    uvicorn.run(app, host="0.0.0.0", port=port)