chore: initial project scaffolding with fastapi, docker and modular
structure
This commit is contained in:
4
app/api/v1/router.py
Normal file
4
app/api/v1/router.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
api_router = APIRouter()
|
||||
# Qui includi tutti i moduli (scope) che creerai
|
||||
17
app/core/config.py
Normal file
17
app/core/config.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
PROJECT_NAME: str = "Playtomic Wrapper"
|
||||
VERSION: str = "1.0.0"
|
||||
API_V1_STR: str = "/api/v1"
|
||||
|
||||
PLAYTOMIC_EMAIL: str
|
||||
PLAYTOMIC_PASSWORD: str
|
||||
PLAYTOMIC_API_URL: str = "https://api.playtomic.io"
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
17
app/main.py
Normal file
17
app/main.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app.api.v1.router import api_router
|
||||
from app.core.config import settings
|
||||
|
||||
app = FastAPI(
|
||||
title=settings.PROJECT_NAME,
|
||||
version=settings.VERSION, # Versioning dell'app
|
||||
)
|
||||
|
||||
# Montiamo le rotte sotto il prefisso /api/v1
|
||||
app.include_router(api_router, prefix=settings.API_V1_STR)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health_check():
|
||||
return {"status": "ok", "version": settings.VERSION}
|
||||
Reference in New Issue
Block a user