CouchDB - share functions across views, across design documents, across databases

你。 提交于 2019-12-03 21:32:40

CouchDB now supports code sharing as CommonJS modules.

http://docs.couchbase.org/couchdb-release-1.1/index.html#couchdb-release-1.1-commonjs

http://caolanmcmahon.com/posts/commonjs_modules_in_couchdb

In this way, you can share your javascript modules between views, lists, and shows in the same design doc. (Server-side)

Also, you can load these modules on the browser side with this library: https://github.com/couchapp/couchapp/blob/master/couchapp/templates/vendor/couchapp/_attachments/jquery.couch.app.js

You also might want to look at Kanso:

http://kansojs.org/

It does a really good job of making your javascript work seemless between the server and client.

You can find some helpful tools here : https://github.com/vivekpathak/casters

The running examples and test cases may particularly help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!