26 lines
512 B
Python
26 lines
512 B
Python
from fastapi import FastAPI
|
|
|
|
from fastapi.responses import FileResponse
|
|
|
|
from app.api.main import api_router
|
|
from app.core.config import settings
|
|
|
|
from app.core.db import init_db, engine
|
|
|
|
from sqlmodel import Session
|
|
|
|
with Session(engine) as session:
|
|
init_db(session)
|
|
|
|
app = FastAPI(
|
|
title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json"
|
|
)
|
|
|
|
@api_router.get("/")
|
|
def index():
|
|
return FileResponse("app/index.html")
|
|
|
|
app.include_router(api_router, prefix=settings.API_V1_STR)
|
|
|
|
|