How to use CouchDB with Ember Data 2.0?


#1

I want to use CouchDB with Ember Data using the latest changes to the Serializer API and Adapter hooks. I’ve read the latest blog post about Ember Data, but it is not clear to me which adapter and serializer I should extend.

Here are the specific questions I have:

  1. Should I extend DS.Adapter, DS.RESTAdapter, or DS.JSONAPIAdapter?

  2. Similarly, which Serializer should I extend?

  3. What is the best resource to learn how to author custom serializers and adapters?


#2

How about your use it with PouchDB?

There are quite a few PouchDB adapters out there.


#3

Thanks for the reply. I am definitely going to use PouchDB on the mobile version of the app, but on the desktop version (and with some models on the mobile version) I want to persist directly to CouchDB. As a side note, I am using PouchDB exclusively in my current implementation of the app that is written in AngularJS and it works great online and off, so I am a big fan of PouchDB.

Also, I would like to build an adapter and serializer myself to learn the internals of Ember Data.


#4

PouchDB will auto-sync to CouchDB.

Here’s an example PouchDB adapter I wrote. It’s old (beta 12) and you shouldn’t use it, but is simple and serves as an example. https://github.com/BFalkner/ember-cli-couchdb/blob/master/addon/adapters/couchdb.js


#5

Hey, There is an ember addon CouchDB:


#6

On repository page it say, ‘tested to work with Ember 2.0.0 and Ember Data 2.0.0.’. Will it work with previous versions of ember and ember-data.? I am on Ember 1.12 and Ember-data v1.0.0-beta.16.1.


#7

Hey, I would use Ember-couch-kit for versions before ember 2.0


#8

Now that Ember Data seems to be more stable I’m back at this.

I want to build my own CouchDB adapter and serializer so that I understand them enough to make modifications, etc. Again, which adapter and serializer should I start with?


#9

Hey see a Great tutorial about it, see https://teamgaslight.com/blog/offline-web-applications-with-couchdb-pouchdb-and-ember-cli I knew about it from @tomdale