diff options
author | Parker <contact@pkrm.dev> | 2024-11-11 23:57:44 -0600 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-11-11 23:57:44 -0600 |
commit | 52127adb08cff9e6bf6bad0125c3b5f7e0d04db2 (patch) | |
tree | 9b2b8a793aed986a54603b8530af2a0f8ae4ca30 /api/main.py | |
parent | 386e6dcb35c866d204e2d32fd814aa7ca3ed15ae (diff) |
Merge API+APP in Docker
Diffstat (limited to 'api/main.py')
-rw-r--r-- | api/main.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/api/main.py b/api/main.py index 8ce333f..8be260d 100644 --- a/api/main.py +++ b/api/main.py @@ -67,20 +67,10 @@ async def log_redirect( return RedirectResponse(url=link_record.redirect_link) -# Redirect /api -> /api/docs -@app.get("/api") -async def redirect_to_docs(): - return RedirectResponse(url="/docs") - - # Custom handler for 404 errors @app.exception_handler(HTTP_404_NOT_FOUND) async def custom_404_handler(request: Request, exc: HTTPException): - # If the request is from /api, return a JSON response - if request.url.path.startswith("/api"): - return JSONResponse( - status_code=404, - content={"message": "Resource not found"}, - ) - # Otherwise, redirect to the login page - return RedirectResponse(url="/login") + return JSONResponse( + status_code=404, + content={"message": "Resource not found"}, + ) |