added middelware
Some checks failed
Build, Push, and Deploy to Nomad / docker-nomad (push) Has been cancelled

This commit is contained in:
2024-12-10 22:41:10 +01:00
parent 669098e568
commit 31f0f49dec
3 changed files with 2502 additions and 1816 deletions

13
app.py
View File

@@ -1,3 +1,4 @@
import uvicorn
from fastapi import FastAPI, Request
from fastapi.staticfiles import StaticFiles
from fastapi.responses import HTMLResponse
@@ -53,4 +54,14 @@ async def get_category(request: Request, category_name: str):
"content": category_content
},
)
return HTMLResponse("Kategori ikke fundet", status_code=404)
return HTMLResponse("Kategori ikke fundet", status_code=404)
# Main entry point
def main():
"""Run the FastAPI app directly"""
uvicorn.run("app:app", host="0.0.0.0", port=8000, reload=True, proxy_headers=True)
# Run main when executed directly
if __name__ == "__main__":
main()