Cow Chap

Digesting Couchapp.

I ran through the documentation at, and set up a test site.  I looked through the test, and saw a buncha stuff I didn’t write.  I like that and don’t like that.  I find app builders lead to cruft laying around—like I noticed jquery 1.2.6 when the latest is 1.3.2 if I remember correctly.  And from the documentation on the wiki, I didn’t really understand what all the files were.  Of course there is no data in the DB, I expected a no-op application, but I didn’t see even *why* all that stuff was there in the lib and vendor and so on.

Then I finally hit upon the actual README at  Perhaps it is just years of reading text books, but I found this page to be much more helpful.  I think I get it.  All the library stuff gets shoved into the couchdb as part of the application.  Then the couchapp glue uses macros to leverage the libraries.  Kinda like lots of other programming languages do it, but probably closest to how most HTML templating languages work.  You follow the template construct, for example,

// !json

and the output is expanded according to what is found at In the test app case, I don’t have a, but I do see a lib.templates.example that shows an html document.  And of course, the thing at the end of the macro rainbow can be useful too, with javascript and queries to the db, etc etc.

Apparently these macros can be used for views (map, and I assume reduce), and it says lists and shows, but I am not yet familiar with those two constructs.

As I said at the start, lots to digest.

And as a quick update, lists and shows are cool too. Very similar to how I process json now in javascript, but on the serverside, and allowing a bit more flexibility. I’m thinking pulling filenames from couchdb based on meta data in the doc, and mapping those to actual image files. I still think I should be wrapping my couch apps in Perl or Java, but there is less and less work to do by the wrapper as this project matures.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s