File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -221,7 +221,25 @@ class CarModule(ModuleBase):
221221 pass
222222```
223223
224+ ## Registering Module
225+ Ellar is not aware of ` CarModule ` yet, so we need to add it to the ` modules ` list of ` ApplicationModule ` at the ` carsite/root_module.py ` .
226+ ``` python
227+ from ellar.common import Module, exception_handler
228+ from ellar.core import ModuleBase
229+ from ellar.core.connection import Request
230+ from ellar.core.response import JSONResponse, Response
231+
232+ from ellar.samples.modules import HomeModule
233+ from .apps.car.module import CarModule
224234
235+
236+ @Module (modules = [HomeModule, CarModule])
237+ class ApplicationModule (ModuleBase ):
238+ @exception_handler (404 )
239+ def exception_404_handler (cls , request : Request, exc : Exception ) -> Response:
240+ return JSONResponse(dict (detail = " Resource not found." ))
241+
242+ ```
225243## Enabling OpenAPI Docs
226244To start up openapi, we need to go back to project folder in the ` server.py `
227245then add the following below.
You can’t perform that action at this time.
0 commit comments