#Nested RouterModules.

3 messages · Page 1 of 1 (latest)

random estuary
#

I have an API module, and it uses the RouterModule to prefix all controllers with /api. I have another module called DocModule, and it prefixes all of its controllers with /doc.

I want to nest the DocModule inside the API Module, so that all of the endpoints of the DocModule become /api/doc.

How can I do this without the DocModule knowing about the /api prefix?

stone bronze
#

Can't you make the DocModule having a basic path: 'doc' and declare all sub-modules as children ?

random estuary
#

there are no sub modules under DocModule, DocModule is the sub module.

it goes API Module -> DocModule -> Doc Controllers

and the path should be /api/doc/test for the TestController.

The TestController is loaded by the DocModule, and the DocModule shouldn't know about the API Module.