Looking win a way to make EmberJS play nice with my legacy App

Hi guys,

I’m looking to EmberJS to start a slow migration of the application that I work, but there is the questions which I don’t have a response yet:

  • Because of performance issues we need to render the html in the server and do the bind in the server in the first load, after that it will be fine to use EmeberJS mechanism, there is a way to do it using EmberJS?
  • How I can slowly integrate EmberJS to play nice the the legacy JS code until I have migrate the whole code to EmberJS?
  • Is Ember Data mature enough to be used in production or I still need to use another Rest API lib to map non-Rest APIs?

Thanks,

Pablo

For 1), correct me if im wrong - i dont think you can do that in Ember right now. The usual practice is to send down the template and data json to the client upon first load, and use the data to render views immediately.

I would be very interested in its possibility as well.

1 Like

Yes, I agree with you and that is the strategy that everybody is using at the moment.

  1. You can render your application after you have rendered server-side html in a div on the page by using the rootElement property of the Ember.Application class.

  2. You can integrate Ember with a legacy code base by writing new functionality in a separate Ember-Application with the rootElement ‘trick’ I explained in 1). If you need small widgets that are very interactive and you don’t want to code new js-code and to rewrite it all again after you have made the switch to ember, you can build new stuff as an ember-component and render the component in a separate ember-application in your current page (you can have multiple ember-apps on one page). also you can interact with components and applications out of ‘normal’ js code. But I think the cleanest approach is using ember-components if you want to build some new widgets.

  3. Ember is mature enough to be used in production. We are using it in production in an application that has 25 million users and we couldn’t be happier with Ember. Ember-Data is a bit rough on the edges but we are also using Ember-Data in production since the beginning 1 1/2 years ago. If things get complicated with ember-data you can adjust its behaviour pretty easily or in the worst case fallback to normal ajax calls.

I gave a talk about this topic some time ago and just uploaded it to slideshare:

2 Likes

I thin what @pablolmiranda wants is to have the element already rendered in the DOM from the server side, and then have an Ember view initializes itself and handle whatever happens to that element. I vaguely remember I used to do this in Backbone.js. It is not possible now.

1 Like