first commit
This commit is contained in:
commit
7a72438fd1
74 changed files with 7548 additions and 0 deletions
58
backend/main.py
Normal file
58
backend/main.py
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from app.database import connect_db, close_db
|
||||
from app.config import get_settings
|
||||
from app.routers import auth, resume, requirements, schedule, questions, pronunciation
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
await connect_db()
|
||||
yield
|
||||
await close_db()
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="HireAI API",
|
||||
description="AI-powered hiring platform backend",
|
||||
version="1.0.0",
|
||||
lifespan=lifespan,
|
||||
docs_url="/docs",
|
||||
redoc_url="/redoc",
|
||||
)
|
||||
|
||||
# ── CORS ────────────────────────────────────────────────────────
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=[settings.frontend_url, "http://localhost:5173"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# ── Routers ─────────────────────────────────────────────────────
|
||||
app.include_router(auth.router)
|
||||
app.include_router(resume.router)
|
||||
app.include_router(requirements.router)
|
||||
app.include_router(schedule.router)
|
||||
app.include_router(questions.router)
|
||||
app.include_router(pronunciation.router)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {
|
||||
"app": "HireAI API",
|
||||
"version": "1.0.0",
|
||||
"status": "running",
|
||||
"docs": "/docs",
|
||||
}
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
return {"status": "ok"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue