Your SlideShare is downloading. ×
CouchApp Build scalable web applications and relax Wien, 7. April 2011 Gerhard Hipfinger
Before we begin First we need a brief intro to CouchDB
CouchDB is a schema free document store Access your documents via restful HTTP API JSON is used as document format What is...
A simple example { "_id": "e3bcabbd12e92e4ea28198f5ad00756a", "_rev": "57-68386422f4554...
How to access documents? Directly by URL and the document key Views (JavaScript Map/Reduce Scripts)
Map/Reduce sample function(doc) { if(doc.docType == 'TempoUser') { var date = doc.creation.substring(0,10); emit(date, 1);...
What else can we do? Update functions for validation or authorization List functions for rendering lists Show functions fo...
So what? Finally   you   can   save   your  app in CouchDB!
Now what's about CouchApp? CouchApp is a tool that helps you organize your CouchDB apps It's  something like  Ruby  on   R...
First steps with CouchApp Install CouchApp – it's a Python app Generate an application with couchapp generate You now have...
Maintain and Deploy  You can use git, svn or whatever you want to manage your app couchapp push  is used to deploy your ap...
CouchApp file mapping myapp/ views/ foobar/ map.js reduce.js { "_id" : "_design/myapp", "views&qu...
CouchApp programming model CouchApp is much more than a code generator It also contains frontend libraries for fast UI dev...
One solution for all apps? Relax in any case?
One solution for all apps? NO CouchApp is great to manage your design  documents Don't manage your design documents (views...
Good for... Small web apps that can be handled in a single  page (like GWT) When your webapp does not require massive busi...
Questions?
Useful resources http://couchapp.org/ http://couchapp.org/page/evently-primer http://couchapp.org/page/evently-do-it-yours...
Gerhard Hipfinger openForce Information Technology GesmbH Dresdner Str. 108 / 3. Stock / Top 11 1200 Wien TEL +43 1 319177...
Upcoming SlideShare
Loading in...5
×

CouchApp - Build scalable web applications and relax

2,207

Published on

An introduction to CouchApp. Contains a brief intro to CouchDB than explains how to use CouchApp to maintain your design documents and how to create websites served by CouchDB.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,207
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "CouchApp - Build scalable web applications and relax"

  1. 1. CouchApp Build scalable web applications and relax Wien, 7. April 2011 Gerhard Hipfinger
  2. 2. Before we begin First we need a brief intro to CouchDB
  3. 3. CouchDB is a schema free document store Access your documents via restful HTTP API JSON is used as document format What is CouchDB?
  4. 4. A simple example { "_id": "e3bcabbd12e92e4ea28198f5ad00756a", "_rev": "57-68386422f4554017aae948f0e5526425", "active": true, "email": "gerhard.hipfinger@openforce.com", "firstname": "Gerhard", "lastname": "Hipfinger", "dbName": "tempo_93aa6c3872ea46bb909365317c8dbfc3", "liveViewDayFolded": true, "liveViewWeekFolded": false, "liveViewMonthFolded": false, "creation": "2010-08-03T17:54:05.641+02:00", "docType": "TempoUser" }
  5. 5. How to access documents? Directly by URL and the document key Views (JavaScript Map/Reduce Scripts)
  6. 6. Map/Reduce sample function(doc) { if(doc.docType == 'TempoUser') { var date = doc.creation.substring(0,10); emit(date, 1); } } Map function Reduce function function(keys, values, rereduce) { return sum(values); }
  7. 7. What else can we do? Update functions for validation or authorization List functions for rendering lists Show functions for showing documents Binary attachments
  8. 8. So what? Finally you can save your app in CouchDB!
  9. 9. Now what's about CouchApp? CouchApp is a tool that helps you organize your CouchDB apps It's something like Ruby on Rails for CouchDB apps But it's not that easy and mature!
  10. 10. First steps with CouchApp Install CouchApp – it's a Python app Generate an application with couchapp generate You now have an ready to deploy CouchDB app
  11. 11. Maintain and Deploy You can use git, svn or whatever you want to manage your app couchapp push is used to deploy your app to a CouchDB node CouchApp finally helps you to maintain your design documents
  12. 12. CouchApp file mapping myapp/ views/ foobar/ map.js reduce.js { "_id" : "_design/myapp", "views" : { "foobar" : { "map" : "contents of map.js", "reduce" : "contents of reduce.js" } } }
  13. 13. CouchApp programming model CouchApp is much more than a code generator It also contains frontend libraries for fast UI development jQuery based Ajax „Evently“ and „Pathbinder“ JavaScript Frameworks for UI event handling
  14. 14. One solution for all apps? Relax in any case?
  15. 15. One solution for all apps? NO CouchApp is great to manage your design documents Don't manage your design documents (views, update functions) without CouchApp But be carefull when you try to create webapps only with CouchApp!
  16. 16. Good for... Small web apps that can be handled in a single page (like GWT) When your webapp does not require massive busines logic Bigger sites become hard to maintain Tool support only rudimentary
  17. 17. Questions?
  18. 18. Useful resources http://couchapp.org/ http://couchapp.org/page/evently-primer http://couchapp.org/page/evently-do-it-yourself http://couchdb.apache.org/ http://guide.couchdb.org/
  19. 19. Gerhard Hipfinger openForce Information Technology GesmbH Dresdner Str. 108 / 3. Stock / Top 11 1200 Wien TEL +43 1 3191775 FAX +43 1 3191775-20 http://openforce.com

×