feat: modules and module-editor pages
This commit is contained in:
9
main.py
9
main.py
@ -7,7 +7,7 @@ from starlette.responses import JSONResponse
|
||||
|
||||
import routers
|
||||
from utils.auto_include_routers import auto_include_routers
|
||||
from utils.exceptions import ObjectNotFoundException
|
||||
from utils.exceptions import *
|
||||
|
||||
origins = ["http://localhost:3000"]
|
||||
|
||||
@ -31,10 +31,15 @@ app.add_middleware(
|
||||
|
||||
|
||||
@app.exception_handler(ObjectNotFoundException)
|
||||
async def unicorn_exception_handler(request: Request, exc: ObjectNotFoundException):
|
||||
async def not_found_exception_handler(request: Request, exc: ObjectNotFoundException):
|
||||
return JSONResponse(status_code=404, content={"detail": exc.name})
|
||||
|
||||
|
||||
@app.exception_handler(ForbiddenException)
|
||||
async def forbidden_exception_handler(request: Request, exc: ForbiddenException):
|
||||
return JSONResponse(status_code=403, content={"detail": exc.name})
|
||||
|
||||
|
||||
auto_include_routers(app, routers, True)
|
||||
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
Reference in New Issue
Block a user