扩展Ember RESTAdapter以使用CouchDB [英] Extend Ember RESTAdapter to work with CouchDB

查看:116
本文介绍了扩展Ember RESTAdapter以使用CouchDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上是使用CouchDB来完成后端,Ember基本上是我的整个前端,我需要找到一种方法来使json数据在两者之间兼容,特别是关于'named root' (以下是 ember json期望 couch api )。我不使用Ruby或任何其他库,所以我确信这个沙发适配器不适用于我。



我读了这里,我需要扩展提取方法以使其正常工作,但是我感到害怕这整个事情,我不知道从哪里开始。 RESTAdapter JSONSerializer 之间的关系是什么?我不知道这一切如何都融合在一起,我害怕浪费时间,也可能拧紧一些东西。还有一个更简单的方法可以做到这一点吗?



原谅我的无聊。

解决方案

有一个CouchDB适配器似乎是最新的(最近更新于2天前),在 https://github.com/roundscope/ember-couchdb-kit 。正如它所说,受 pangratz / ember-couchdb-adapter 的启发,并包含许多修复和新手功能。



虽然在Rails项目中安装很简单,但是在Rails项目之外还是很好的。只需按照以下顺序从 dist 目录中的所有内容:




  • ember-couchdb-套件

  • 注册表

  • 文件适配器

  • 附件适配器

  • revs-adapter

  • change-feed


I am using CouchDB for basically my entire back-end, and Ember for basically my entire front-end, and I need to find a way to make the json data compatible between the two, especially regarding the 'named root' convention (here are the ember json expectations and the couch api). I'm not using Ruby or any other libraries, so I'm quite sure this couch adapter isn't available to me.

I read here that I'll need to extend the extract method to get this to work properly, but I'm freaked out by this whole thing and am not sure where to start. What's the relationship between RESTAdapter and JSONSerializer? I'm not sure how this all fits together and I'm terrified of wasting time and possibly screwing something up. And is there maybe an easier way to do this?

Forgive my noobiness.

解决方案

There's a CouchDB adapter that does seem to be up to date (last updated 2 days ago), at https://github.com/roundscope/ember-couchdb-kit. As it says, "Inspired by pangratz/ember-couchdb-adapter and contains many fixes and newbie features."

While the installation is easy within a Rails project, it's still fine outside of a Rails project. Just include everything from the dist directory in this order:

  • ember-couchdb-kit
  • registry
  • document-adapter
  • attachment-adapter
  • revs-adapter
  • changes-feed

这篇关于扩展Ember RESTAdapter以使用CouchDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆