feat: set root path for FastAPI application
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 8s
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 8s
This commit is contained in:
@@ -8,12 +8,13 @@ from fastapi import HTTPException
|
|||||||
|
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
|
root_path="/api",
|
||||||
title="MITM Webserver Backend",
|
title="MITM Webserver Backend",
|
||||||
description="Backend API for MITM Webserver",
|
description="Backend API for MITM Webserver",
|
||||||
version="1.0.0",
|
version="1.0.0",
|
||||||
docs_url="/api/docs",
|
docs_url="/docs",
|
||||||
redoc_url="/api/redoc",
|
redoc_url="/redoc",
|
||||||
openapi_url="/api/openapi.json",
|
openapi_url="/openapi.json",
|
||||||
)
|
)
|
||||||
|
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
@@ -39,16 +40,16 @@ def shutdown_event():
|
|||||||
# Basic Endpoints
|
# Basic Endpoints
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|
||||||
@app.get("/api/hello")
|
@app.get("/hello")
|
||||||
def hello():
|
def hello():
|
||||||
return {"message": "Hello from FastAPI 🎉"}
|
return {"message": "Hello from FastAPI 🎉"}
|
||||||
|
|
||||||
@app.get("/api/versions")
|
@app.get("/versions")
|
||||||
def versions():
|
def versions():
|
||||||
message = os.popen("python --version").read().strip()
|
message = os.popen("python --version").read().strip()
|
||||||
return {"message": message}
|
return {"message": message}
|
||||||
|
|
||||||
@app.get("/api/nft/ruleset")
|
@app.get("/nft/ruleset")
|
||||||
def nft_ruleset():
|
def nft_ruleset():
|
||||||
message = os.popen("sudo nft --json list ruleset").read().strip()
|
message = os.popen("sudo nft --json list ruleset").read().strip()
|
||||||
return {"message": message}
|
return {"message": message}
|
||||||
|
|||||||
Reference in New Issue
Block a user