27 lines
598 B
Python
27 lines
598 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from .providers.db_provider import create_db_and_tables
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(_app: FastAPI):
|
|
create_db_and_tables()
|
|
yield
|
|
|
|
app = FastAPI(
|
|
title="Fair Housing API",
|
|
description="Provides access to core functionality for the fair housing platform.",
|
|
version="1.0.0"
|
|
)
|
|
|
|
# Add CORS middleware
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|