Ember CLI + Express.js

I’m a programming beginner Things I’ve had my hands on are HTML, CSS, JavaScript, jQuery, Express.js, MongoDB, Mongoose.js.

I’ve built a simple blog with those. For the sake of learning I would like to use a front-end framework… I was trying to learn and use backbone at first, but our relationship wasn’t that smooth. So after struggling with it for couple of month - I’ve decided to take a look at smtn else. So it brings me here…

My question/favor is… I have an idea on how to built a simple app with express, even though I’m not sure and I didn’t try, yet - I’d like to see how ember cli would work with express.js.

On Ember CLI TUTORIALS The very first thing is Rails + Ember.js (with the Ember CLI)

Is there any chance to have something like Express.js + Ember.js (with the Ember CLI) Would be awesome to see

  • how app is structured
  • how ember talks to API
  • how is it deployed
  • how the build process works.

I’ve tried to play around with it, but unfortunately I’m a beginner and it all looks weird.
Any links to resources, tuts for these two techs together are highly appreciated.

1 Like

I am using Sails, which sits on top of Express. It provides basic blueprints which you can modify or you can define your own custom actions through routes and controller actions. It is quite easy to set up basic Sails+Ember project, but this basic setting may be hard to develop in. I had to develop front end and back-end separately which is a pain. Now there are some cool projects which let you run both front end and back end servers at the same time.

I have a good experience with this: https://chiefy.github.io/2014/09/03/sails-generate-ember.html

Only thing I struggle with at the moment is populating models. I have to use DS.attr(‘string’) and populate things explicitly…

As @rubisco we are also using Sails since it brings a more ember-y approach to Node, but we baked our own cli: http://artificialio.github.io/sane/ which is still very much WIP but already used by us in production.

It comes with a slightly different approach and folder structure then sails-generate-ember and sees ember more as a 3rd Party App, similar to an iPhone or Android App, that you then can simply deploy with the server (but could also deploy separately if you choose). It now also has a generator for creating models on the backend as well as the frontend.

Anyway, it might help you out, or might also just give you an idea about how to structure the app.

Edit: I am also planning to do a youtube video on how the stack/cli exactly work.

I have recently written up a small blogging engine with an Ember front-end, using MongoDB and Express on the backend. I have yet to write a tutorial for it unfortunately, but the code is available on GitHub, in two separate projects; the frontend and backend. This may be useful to you as a reference.

The basic meat and potatoes of it is that you want to build a service that conforms to Ember-Data. You want to build an Express server that serves as an API for your data persistence solution (in this case Mongo), that will respond to the requests ember-data will make, and with responses following the right JSON conventions. The ember.js guides specify the URLs and JSON conventions ember-data requires.

EDIT: An ember-cli app automatically includes the ember-data lib, FYI

I’ve uploaded a demonstration to github on how to use MongoDb, ExpressJS and Ember-Cli together.

This demo project contains a basic user management and a article CRUD module. User authentication is done with ember-simple-auth on the client side. The server uses passportjs for authentication and a jws token to secure the api endpoints.

Server and client are on the same project but each starts it’s own http-server instance, that’s not ideal and I will change that. Also there is no deployment strategy for now.

I will continue to work on this project adding deployment steps and code generation for server routes, model and controllers, like ember-cli does.

This might be a bit late but here’s a great write up:

http://connorbrewster.me/nodejs-rest-server-emberjs/

I am using pure Express.js app to work with Ember-data and Ember-cli so if anyone is going to write a boilerplate, feel free to contact me and we can scaffold something together.

Any updates on this? Would love to read up on all that :slight_smile:

Hi! Were you able to find information on Ember CLI + Express ?? Thanks!

Can you clarify what you mean by connection?

You just want your express app to serve up your ember assets? If so, a few of the responses above already answered that.