Adding addons at runtime


#1

Hi all ember friends,

I hope I can describe my question good enough in english. :slight_smile:

Question: Is there a possibility in ember to resolving addons at runtime?

In our company working based on micro services. To render a typical page we have a server side rendering technology where we can use a custom HTML tag in our templates to include any contents from any number of micro services. So a page will be resolved recursively at the server side. A typical include calls a UI endpoint of the related micro service. The response can be only a HTML template but also with more includes for CSS files ( Links ) or Javascripts ( Script Sources ).

Now we implement have to implement a “Single Page Application” but the individual components ( Template, Component Controller and any CSS Files … maybe as ember addons ) should be resolved first at runtime because changes by any used micro services should not needs a new deployment from the own service.

I hope my description is good to understand our problem. :slight_smile: We use ember for years in some little and bigger admin applications but for this new application we must not implement a monolith application.

Best regards, Mario


#2

Here a little example for my question:

Template Example

<div class="myPage">
   <service-include src="https://path/to/info-service/infoButton"></service-include>
   <service-include src="https://path/to/basket-service/customers/12345/basketLineItems"></service-include>
</div>

Output Example

<div class="myPage">

  <link rel="stylesheet" href="path/to/info-service-button.css" />
  <button id="info-service-button">Information</button>

  <link rel="stylesheet" href="path/to/basket-service-lineitems.css" />
  <ul>
    <li>Product 1</li>
    <li>Product 2</li>
    <li>Product 3</li>
  </ul>
  <script src="path/to/basket-lineitems.js"></script>

</div>

The idea behind this example is

  1. we would like to have a component where we can call any endpoints to get any responces
  2. any answer can have any service-includes again that also have to resolved after
  3. it would be perfect when if it were possible to get a VUE component from an external url ( other service ) with all their related Javascript, CSS and template … and after this the component should initialized as if it already existed

The great challenge here is

  • in the world of micro services > in each service are all related templates, CSS and needed Javascripts
  • no dependencies to other services
  • no script of a component in a service have to use other scripts from other services
  • we like to have all advantages of a single page application for a better usability and feeling etc…

Hope this example describes our problem a little better.

Greetings Mario