feat: set root path for FastAPI application
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 8s

This commit is contained in:
2025-11-23 15:44:37 +01:00
parent 31601afd52
commit 515237d43e

View File

@@ -8,12 +8,13 @@ from fastapi import HTTPException
app = FastAPI(
root_path="/api",
title="MITM Webserver Backend",
description="Backend API for MITM Webserver",
version="1.0.0",
docs_url="/api/docs",
redoc_url="/api/redoc",
openapi_url="/api/openapi.json",
docs_url="/docs",
redoc_url="/redoc",
openapi_url="/openapi.json",
)
app.add_middleware(
@@ -39,16 +40,16 @@ def shutdown_event():
# Basic Endpoints
# ---------------------
@app.get("/api/hello")
@app.get("/hello")
def hello():
return {"message": "Hello from FastAPI 🎉"}
@app.get("/api/versions")
@app.get("/versions")
def versions():
message = os.popen("python --version").read().strip()
return {"message": message}
@app.get("/api/nft/ruleset")
@app.get("/nft/ruleset")
def nft_ruleset():
message = os.popen("sudo nft --json list ruleset").read().strip()
return {"message": message}