
- Create user model and database connection - Set up Alembic migrations - Implement JWT token authentication - Add routes for registration, login, refresh, and user profile - Create health endpoint - Configure CORS - Update README with setup and usage instructions
29 lines
702 B
Python
29 lines
702 B
Python
import uvicorn
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api.v1.auth import router as auth_router
|
|
from app.api.v1.health import router as health_router
|
|
|
|
|
|
app = FastAPI(
|
|
title="User Authentication Service",
|
|
description="A FastAPI service for user authentication",
|
|
version="0.1.0",
|
|
)
|
|
|
|
# Configure CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(auth_router, prefix="/api/v1")
|
|
app.include_router(health_router)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) |