As my application grows, I feel the need for a more structured configuration of the router / controller. Marionette docs mention the following:
It is recommended to separate controller objects into smaller parts of related functions and have several routers / controllers, and not just one giant router and controller.
It would be great if there was an example of such a structure. Suppose I have a three-section website; People, media and articles. Ideally, I would like to have routers / controllers for each partition. Something like that:
App -- AppRouter -- AppController -- AppLayout -- PeopleRouter -- PeopleController -- PeopleLayout -- MediaRouter -- MediaController -- MediaLayout -- ArticleRouter -- ArticleController -- ArticleLayout
It is very unclear to me how I can let the route ("/ people / detail / 1") be handled by a different router than the AppRouter. I seem to need to create modules for each section, but does this work well with RequireJS? It seems a little strange to use two different types of modules ...
It would be great if someone could point me in the right direction, all the examples that I found on the Internet are a bit confusing to me.
marionette
thomasjonas
source share