initial - add implementation for simple crowdsec app to list and delete non-CAPI decisions
This commit is contained in:
commit
9aaf3d32d0
7 changed files with 349 additions and 0 deletions
21
app/main.py
Normal file
21
app/main.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from fastapi import FastAPI, Request
|
||||
from fastapi.responses import HTMLResponse
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from app.api import router as api_router
|
||||
from app.crowdsec_api import list_decisions
|
||||
|
||||
app = FastAPI(title="CrowdSec Web UI")
|
||||
|
||||
# Include API
|
||||
app.include_router(api_router, prefix="/api")
|
||||
|
||||
# Templates
|
||||
templates = Jinja2Templates(directory="app/templates")
|
||||
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
async def index(request: Request):
|
||||
decisions = await list_decisions()
|
||||
return templates.TemplateResponse(
|
||||
"index.html", {"request": request, "decisions": decisions}
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue