Skip to content

Commit

Permalink
http 404 endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed May 29, 2024
1 parent 81f2cb4 commit 3f6bad0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion store/app/api/routers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging

from fastapi import APIRouter
from fastapi import APIRouter, HTTPException, status

from store.app.api.routers.users import users_router

Expand All @@ -11,3 +11,9 @@
api_router = APIRouter()

api_router.include_router(users_router, prefix="/users", tags=["users"])


# Returns a 404 response for all other paths.
@api_router.get("/{path:path}")
async def not_found(path: str) -> dict[str, str]:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Endpoint not found")

0 comments on commit 3f6bad0

Please sign in to comment.