diff --git a/runner/backend/__init__.py b/runner/backend/__init__.py new file mode 100644 index 0000000..9af9555 --- /dev/null +++ b/runner/backend/__init__.py @@ -0,0 +1,23 @@ +from fastapi import FastAPI, Query, HTTPException +from fastapi.responses import Response +import lib.target as target + +app = FastAPI() + + +@app.post("/start") +async def start(url: str = Query(None)): + if url: + target.save(url) + print(f"Target URL set to: {url}") + return {"message": f"Target URL set to: {url}"} + return {"error": "No URL provided"} + + +@app.exception_handler(404) +async def not_found_handler(request, exc): + return Response(status_code=404) + +@app.exception_handler(405) +async def method_not_allowed_handler(request, exc): + return Response(status_code=405) \ No newline at end of file