开发者

Is there a simpler Couchapp than Couchapp?

Specifically, I am finding "evently" to be a bit of a hurdle to getting started with Couch开发者_开发百科app. I really like the idea of an App served from CouchDB, but I want to get started without having to figure out "evently" ( which looks very interesting, like something I would want to investigate, but not right now ). I just want to make a simple CouchDB App using my existing javascript skills and my new CouchDB knowlege. Is there a simpler CouchApp than CouchApp? Or can I make it simpler? Or should I just drink the kool-aid and learn the "evently" stuff?

EDIT(3 months later):

Thanks everyone for the answers -- here's what I have figured out:

You can easily use the core features of CouchApp without drinking anyone's Kool-Aid. Specifically, "evently" is absolutely not required for serving an app from CouchDB. The core goodness of CouchApp is simply the "push" function, where it builds your "design doc" from files and folders -- all the rest seems to be a whole javascript framework that you don't have to use.

Once you get past the hurdle of figuring out how to actually serve pages and javascript from CouchDB, you can build your app any way you like. It only requires simple AJAX to get documents and save documents, so the possibilities are endless!


If you're looking for an alternative, you might want to try Kanso. There's a tutorial on the website.

Kanso can also address Dominic Barnes' concerns of working with a single-page app making AJAX calls. Instead, you can have the views rendered client-side when possible (making it fast), but also render the core content server-side if necessary, so search engines and users without javascript can still get at it :)


I never liked Evently either, to be honest. However, I also gave up on CouchApps a while ago because it essentially requires you to use AJAX for your entire application, which isn't good from a usability standpoint.

In any case, if you still want to use CouchApps, I would recommend using Backbone.JS instead of Evently. (there's even a 3rd-party CouchDB connector build for backbone)


You can use the _attachments folder as the document root of your application. For example, if the contents of _id is _design/testapp and .couchapprc is:

{
  "env": {
    "default": {
      "db": "http://USERNAME:PASSWORD@localhost:5984/testdb"
    }
  }
}

then the file _attachments/index.html is at http://localhost:5984/testdb/_design/testapp/index.html.

You can then use jQuery to build your app, doing queries whith getJSON. Or you can use the included wrappers loaded from vendor/couchapp/_attachments/loader.js.

You can also serve dynamic html using show or list functions.


[MANY YEARS LATER]

I've tested many different "couchapp" tools during the last years. These tools are all just fancy JSON builders that bump together written Javascript and attachments into a CouchDB document and push them to the database.

Even if you're not writing strict CouchApps (that hype has faded also, although they're still doable), you still need a tool to write CouchDB design documents.

Today, many of these tools have died -- specially Kanso, which tried to do so much --, and we're left with Python Couchapp, CouchDB Bootstrap, Erica and Ddoc Lab.

It is still complicated to manage design documents, but nowadays Ddoc Lab is my go-to solution, since it runs in the browser, has many interesting features (like including and preprocessing resources) and uses PouchDB -- possibly linked to a CouchDB for storing your project.


I have a simple couchapp replacement called caster.py. It does support push, pull, and generate canonical directory structure for a design document. Additionally it creates running samples for test cases for map/reduce functions which can be hooked into your dev process. It is a single clean python file with no frills.

https://github.com/vivekpathak/casters/releases/latest

Not only is it a complete package for managing code in couchdb design documents - it allows using professional programming tools like debuggers, profilers, version control, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜