from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .db.utils import initialize_database
from .api.endpoints import router as geom_router

app = FastAPI()

origins = [
    "http://localhost:8000",
    "http://localhost:3000",
]

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

initialize_database()

app.include_router(geom_router, prefix="/api/v1")