Multiple routers in a more complex app


I’m trying deploy an application that serves two functionally and aesthetically similar versions – one is deployed at the point of sale, in store, while another is for online use.

I’m trying to figure out the best way to architect this. The fundamental question is **at what level should **

Potential solutions

  1. Use the same router, name spacing the two different app versions in their own resources.
  2. Somehow conditionally instantiate the proper router based on some other data passed by the server
  3. Handle it at the view/template level – still have one router, but adjust how the views / templates display based on some external state.

Of these, I think 3 is the messiest. For 1 and 2, I would want to keep the views and templates as re-composable as possible, so that I can use the same views in both the versions, and only the router, which wires everything together, will be different.

For 1 and 2, I’m not sure whether to define duplicate route handler classes for each of the versions, i.e., OnlineMainRoute, OnlineLoginRoute, InstoreMainRoute, InStoreLoginRoute, versus just MainRoute and LoginRoute.

Has anyone deployed versions of an app / figured out how to use multiple similar versions of a router in Ember.js? Any advice welcome.