35 lines
873 B
Python
35 lines
873 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.routes import auth, health
|
|
|
|
app = FastAPI(
|
|
title="User Authentication Service",
|
|
description="A secure user authentication API built with FastAPI",
|
|
version="1.0.0",
|
|
openapi_url="/openapi.json"
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router)
|
|
app.include_router(health.router)
|
|
|
|
@app.get("/")
|
|
def root():
|
|
return {
|
|
"title": "User Authentication Service",
|
|
"description": "A secure user authentication API built with FastAPI",
|
|
"version": "1.0.0",
|
|
"documentation": "/docs",
|
|
"health_check": "/health"
|
|
}
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(app, host="0.0.0.0", port=8000) |