
- Setup project structure with FastAPI - Create user models with SQLAlchemy - Implement JWT authentication - Create auth endpoints (register, login, me) - Add health endpoint - Generate Alembic migrations - Update documentation Generated with BackendIM... (backend.im)
28 lines
806 B
Python
28 lines
806 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.core.config import settings
|
|
from app.api.endpoints import auth, health
|
|
|
|
app = FastAPI(
|
|
title=settings.PROJECT_NAME,
|
|
version=settings.VERSION,
|
|
description=settings.DESCRIPTION,
|
|
openapi_url=f"{settings.API_V1_STR}/openapi.json",
|
|
docs_url="/docs",
|
|
redoc_url="/redoc",
|
|
)
|
|
|
|
# Set CORS middleware
|
|
if settings.BACKEND_CORS_ORIGINS:
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=[str(origin) for origin in settings.BACKEND_CORS_ORIGINS],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(auth.router, prefix=settings.API_V1_STR, tags=["auth"])
|
|
app.include_router(health.router, tags=["health"]) |