File size: 779 Bytes
55086fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from app.api.v1.endpoints import router as v1_router
from app.core.config import config

main = FastAPI(
    title=config.PROJECT_NAME,
    version=config.VERSION,
    openapi_url=f"{config.API_PREFIX}/openapi.json"
)

main.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

main.include_router(v1_router)

@main.get("/")
async def root():
    return {"message": "Welcome to the Verifacts Backend API!"}

@main.get("/health")
async def health_check():
    return {
        "status": "operational",
        "message": "The Verifacts Backend API is running smoothly.",
        "version": config.VERSION
    }