Package for both server + client? (Ember.Object on the server)


Hi all,

I’m almost certain this is possible but can’t find any pointers to guide me in the right direction…

I have a set of Ember objects in my app that do some complex logic. I’d like to reuse that logic on the backend in some places. My Ember objects don’t interact with the DOM at all but they use Ember.computed heavily and some components tie directly into these objects via computed as well. So, Ember.Object is pretty nice.

Is there a way for me to make an NPM package I can reuse on the server as well as the client? Is this even a sane thing to do? Should I be looking at doing this some other way?

Note that Fastboot isn’t an option here, I’m not trying to pre-render data. I’m trying to actually use the same logic I use on the frontend to insert data into a search cluster. Right now the frontend is doing a lot of computation/analysis on streaming data which is great for realtime. I’d like to run some aggregation later on to send this data to a search cluster, obviously via backend tasks.