- Created docker-compose.yml with Console backend service - Implemented Console backend with FastAPI (port 8011) - Added health check and status endpoints - Set up Docker-only development principle - Console service successfully running as API Gateway foundation Test with: - curl http://localhost:8011/health - curl http://localhost:8011/api/status 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
58 lines
1.2 KiB
Python
58 lines
1.2 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
import uvicorn
|
|
from datetime import datetime
|
|
|
|
app = FastAPI(
|
|
title="Console API Gateway",
|
|
description="Central orchestrator for microservices",
|
|
version="0.1.0"
|
|
)
|
|
|
|
# CORS middleware
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {
|
|
"message": "Console API Gateway",
|
|
"status": "running",
|
|
"timestamp": datetime.now().isoformat()
|
|
}
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
return {
|
|
"status": "healthy",
|
|
"service": "console",
|
|
"timestamp": datetime.now().isoformat()
|
|
}
|
|
|
|
@app.get("/api/status")
|
|
async def system_status():
|
|
return {
|
|
"console": "online",
|
|
"services": {
|
|
"users": "pending",
|
|
"oauth": "pending",
|
|
"images": "pending",
|
|
"applications": "pending",
|
|
"data": "pending",
|
|
"statistics": "pending"
|
|
},
|
|
"timestamp": datetime.now().isoformat()
|
|
}
|
|
|
|
if __name__ == "__main__":
|
|
uvicorn.run(
|
|
"main:app",
|
|
host="0.0.0.0",
|
|
port=8000,
|
|
reload=True
|
|
) |