salary-benchmark/app/main.py
DJP e9b9c66423 Add login (JWT + local admin user) and deploy script for optical-dev
- Backend: users table + admin seed (004), /api/auth endpoints, JWT auth
  dep gating benchmarks + research routes
- Frontend: AuthContext, LoginPage, ProtectedRoute, subpath-aware via
  VITE_BASE / import.meta.env.BASE_URL so same build works at /opt/
- deploy/: Dockerfile.prod, docker-compose.prod.yml, Apache vhost
  fragment template, and idempotent deploy.sh (port scan, rsync, env
  generation, Apache Include + reload)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 19:34:15 -04:00

29 lines
840 B
Python

from fastapi import Depends, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from app.deps import get_current_user
from app.routers import auth, benchmarks, research
app = FastAPI(title="Salary Benchmark Tool")
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173",
"http://localhost:5179",
"https://optical-dev.oliver.solutions",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(auth.router, prefix="/api")
app.include_router(benchmarks.router, prefix="/api", dependencies=[Depends(get_current_user)])
app.include_router(research.router, prefix="/api", dependencies=[Depends(get_current_user)])
@app.get("/api/health")
async def health():
return {"status": "ok"}