There is a lot of documentation of how to structure and create Ember.js apps with Rails as a backend. Pupular solutions are to use gems as ember-rails
and ember-source
or the all in one ember-appkit-rails
.
However i'm trying to create a simple Sinatra app that handle a JSON only backend with Ember.js as the frontend. The few resources that i found seems a little outdated, so i'm looking for simple way to do that.
So my question is:
How i integrate Ember.js with a simple Sinatra backend ??
Examples of how to do so will be appreciated.
There is a very simple repo on Github, that could serve as a starting point for you. Just grab the code, start the sinatra app server, and point your Ember datasource to it, like this:
App.MyRestAdapter = DS.RestAdapter.extend({
host: 'http://localhost:3000',
namespace: 'api'
});
App.store = DS.Store.create({
adapter: 'MyApp.MyRestAdapter'
});
You could also look into the source of Travis CI, as they use Sinatra (travis-api) and Ember.js (travis-web).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With