Download app/main.py from isold/MeloonTop: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/spaces/isold/MeloonTop/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/isold/MeloonTop/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/isold/MeloonTop/resolve/main/app/main.py
1.55 kB
| """Main entry point for the MeloonAITools Backend. | |
| This module initializes the FastAPI application, configures CORS, | |
| and registers all routers for the application. | |
| """ | |
| from typing import Dict | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from app.routers import auth | |
| from app.routers import comments | |
| from app.routers import dynamics | |
| from app.routers import games | |
| from app.routers import prompts | |
| from app.routers import ratings | |
| from app.routers import tools | |
| app = FastAPI( | |
| title="MeloonAITools Backend", | |
| description="Backend API for MeloonAITools using FastAPI and Supabase.", | |
| version="1.0.0", | |
| ) | |
| # Configure CORS | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Adjust according to your frontend URL in production | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Include routers | |
| app.include_router(auth.router, prefix="/api/auth", tags=["Authentication"]) | |
| app.include_router(tools.router, prefix="/api/tools", tags=["Tools"]) | |
| app.include_router(games.router, prefix="/api/games", tags=["Games"]) | |
| app.include_router(prompts.router, prefix="/api/prompts", tags=["Prompts"]) | |
| app.include_router(dynamics.router, prefix="/api/dynamics", tags=["Dynamics"]) | |
| app.include_router(ratings.router, prefix="/api/ratings", tags=["Ratings"]) | |
| app.include_router(comments.router, prefix="/api/comments", tags=["Comments"]) | |
| def read_root() -> Dict[str, str]: | |
| """Returns a welcome message.""" | |
| return {"message": "Welcome to MeloonAITools API"} | |