1

I am creating a website which has multi user concept Like Admin can create teams, assign some sub-apps to team and create a user and assign users to that team

Likewise team admin can add users in a team and check user's statistics and so on.

Users can have some functionalities.

All have their common features like edit profile, login etc.. I am using require js along with Backbone.

Please suggest could i use multiple router or single router ?

Evgeniy
  • 2,915
  • 3
  • 21
  • 35
Ketul
  • 13
  • 3
  • 1
    Your question is pretty broad. Multi router is good in case you split your app in sub apps (modules), for permissions and user access you may need router filters – Evgeniy Nov 17 '14 at 10:21
  • I may have 8 different modules(like user management, site management, team management, message management etc) so i am confused whether to use single router and based on patterns load view/template OR should i use multiple routers ? – Ketul Nov 17 '14 at 10:30
  • ok, and what about routes in each module ? are this modules similar by functionality or just close by naming ? – Evgeniy Nov 17 '14 at 10:40
  • Routers would be something like this... #network/clients #client/1/edit #client/1/apps #site/users #site/apps #site/teams #teams/149 #teams/149/team_apps – Ketul Nov 17 '14 at 10:43
  • if number of routes in not huge try with single router. – Evgeniy Nov 17 '14 at 11:03
  • Thanks Evgeniy, I am implementing with single router as of now and later if require can create subroutes. – Ketul Nov 18 '14 at 07:27

1 Answers1

1

I would recommend having an app router, which can define subrouters - I have written an example here under "Routing" - Backbone project organization

Community
  • 1
  • 1
Dominic
  • 62,658
  • 20
  • 139
  • 163
  • +1 for subrouters. A bit off-top question - What about sub routers lazy - loading ? Imagine, i'm loading sub-apps or modules on-demand by URL match (#/home - HomeApp , #/users - UsersApp). So i have to use something like rootRouter to manage sub-aps loading like `*any : loadApp`, plus sub app hav its own router `{ home/about : showHomeAbout ... }` . So if i navigate to home/about module loading route event fires, sub app router inits but doesent fire showHomeAbout action (as URL has not changed and 'route' already happend on sub app loading). Is any ideas how to orginize such case? many thk – Evgeniy Nov 18 '14 at 07:37
  • @Evgeniy very delayed response but I would have liked some magic there too rather than saying "this path = load this subrouter" -- let me know if you came up with anything – Dominic Jan 26 '15 at 15:39