File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,25 @@ class CarModule(ModuleBase):
221
221
pass
222
222
```
223
223
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
224
234
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
+ ```
225
243
## Enabling OpenAPI Docs
226
244
To start up openapi, we need to go back to project folder in the ` server.py `
227
245
then add the following below.
You can’t perform that action at this time.
0 commit comments