Ember JS and several single-page applications

Let's say I have a web application - a large, complex application for rails, like an accounting application. I see the use of multiple applications with one page, rather than the usual routing pages. For example, I see that the user is better served by an intuitive single-page / dynamic application for:

  • Creating Bank Reconciliation
  • Create an invoice
  • Filling out the time report
  • etc..

These are all great single-page apps ...

All ember applications that I see are one page and one goal.

I want to have many one-page applications built with ember. How does it look in relation to:

Routes: I will have a combination of server routes and client routes. How will it look in Amber? To serve different Ember applications, each with its own application router and routes?

Templates: will all my "applets" be compiled and ported to the client on boot? Or can I use require.js and load each application with one page, depending on what they are aimed at? ...

Can anyone help with these two questions? Thanks in advance!

+7
source share
2 answers

Routes: I will have a combination of server routes and client routes. How will it look in Amber? To serve different Ember applications, each with its own application router and routes?

Depends on how much overlaps in terms of features. Of course, you can serve various Ember applications with your router and routes. In this case, you will probably also write a shared library with common base classes and mixins.

An alternative would be to have one ember application that looks and behaves differently depending on the route. This is where I will start until you have a good feeling for ember, and see a compelling reason to share things.

Templates: will all my "applets" be compiled and ported to the client on boot? Or can I use require.js and load each application with one page, depending on what they are aimed at? ...

The path of least resistance in rails is to use asterisks to compile and pack your templates - after they are compiled they are just javascript. Typically, a rails application associates all javascript with application.js and enables it at startup. An alternative would be to split the code and application templates into app1.js, app2.js, etc. And download them every time the application moves.

+2
source share

I would suggest using a PODS structure, and then you can have routes like

/app1/ /route1 /route2 /app2/ /route1 /route2 etc... 

If you create a block structure, you are, for example, a folder. ember generate route app1\route1

you will have a nice folder structure that you can share later, for example:

  /app /pods/ /app1 /route1 route.js controller.js template.hbs /route2 route.js controller.js template.hbs /app2 /route1 route.js controller.js template.hbs /route2 route.js controller.js template.hbs 
+1
source share

All Articles