H4CK3R-01
1df240c845
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
34 lines
884 B
Python
34 lines
884 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from config.config import initiate_database
|
|
from routes.health import router as HealthRouter
|
|
from routes.request import router as RequestRouter
|
|
from routes.admin import router as AdminRouter
|
|
from config import Settings
|
|
|
|
app = FastAPI(title="Translator",
|
|
description="DHBW Cloud Computing II",
|
|
version="1.0.0",
|
|
root_path='/api')
|
|
|
|
@app.on_event("startup")
|
|
async def start_database():
|
|
await initiate_database()
|
|
|
|
origins = ["*"]
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
app.include_router(RequestRouter, tags=["Requests"])
|
|
app.include_router(HealthRouter, tags=["Health"])
|
|
|
|
if Settings().ENV == "dev":
|
|
app.include_router(AdminRouter, tags=["Admin"]) |