Integrating Ember.js with Node.js (Express+Tower.js)

Panagiotis Panagi picture Panagiotis Panagi · Apr 14, 2012 · Viewed 9.3k times · Source

I'm looking into solutions for integrating Ember.js with Node.js+Express+Tower.js.

I just started looking into Tower.js (the last couple of hours), and it looks like that the framework provides a nice structure for placing both server-side and client-side code (similar to the assets folder in Rails).

Since everything is in Javascript, I could either place Ember application code:

  1. Entirely on the client, i.e., send everything on first request.
  2. Serve only what is initially needed, and serve the rest only upon request.

In the 2nd solution, one could render the views on the server and send pure HTML.

Also what about the application logic of Ember (controllers, models, states, ...). How can it better be integrated with server-side Javascript (e.g., node.js+Express+Tower.js), so that repeated code is minimized. In an ideal scenario, you define each model/controller/etc once and its used both on the server and on the client.

Answer

Lance picture Lance · Apr 15, 2012

We are integrating Ember.js into the core of Tower.js, this has been planned from the beginning.

Not quite there yet. But it's happening next.

Ember currently works in Node.js and the Browser, as does Tower. Controllers on the server will work like Rails' with web socket additions. Controllers on the client will work like they do on the server and like with Ember, with web socket support - still fleshing this out.