2009/6/30 Nicolas Steinmetz : > Hi, > First to introduce myself : New to CouchDB universe, I read the WIP CouchDB > Book, some official documentation and some writings from "benoitc". So now I > try to build my first couchdb app with a simple clone of delicious. couchapp mailing list could be better for that : couchapp@googlegroups.com but I will answer here. > > So in a first part, I installed couchapp 0.3.2 and generate a first project > (called "mycouchapp") and then pushed it on my local couchdb server (using > CouchDBX) in a db called "monapp". > > At this stage, I got the default placeholder from Couchapp. > > Then from Futon, I added 3 documents like this one : > > { >   "_id": "3b0ce9b06a0f7a110dbd8a72b32f2072", >   "_rev": "3-1834349775", >   "title": "CouchDB Official site", >   "url": "http://couchdb.apache.org/", >   "description": "Apache CouchDB is a distributed, fault-tolerant and > schema-free document-oriented database accessible via a RESTful > HTTP/JSON API", >   "tag": [ >       "couchdb", >       "database", >       "document" >   ] > } > > > { >   "_id": "63f417d3d2217e4be4d284a30056c84d", >   "_rev": "2-1087649587", >   "title": "Couchdbkit", >   "description": "Couchdbkit goal is to provide a framework for your > Python application to access and manage Couchdb.", >   "url": "http://www.couchdbkit.org/", >   "tag": [ >       "couchdb", >       "python", >       "framework" >   ] > } > > > { >   "_id": "8fa1e44814d3d1800069127da12e72f9", >   "_rev": "2-3730993466", >   "title": "couchapp", >   "description": "Utilities to make standalone CouchDB application > development simple", >   "url": "http://github.com/couchapp/couchapp/tree/master", >   "tag": [ >       "couchdb", >       "python", >       "ruby" >   ] > } > > > I know I should have used better _id but it's my first try and realised it > too late ;-) > > I played a little bit with Futon to design some temporary view to try > requests against my documents. All went well. > > This done, I would like to create my first lists / shows / views but failed > so far :-( > > I tried to build them by looking mainly at sofa code but I always have 404 > page with not a lot of info for going further. > > I did not forget to push code with couchapp to update my couchdb instance. > > My aim was to create two "pages" : > * One list to display all documents > * One show to display a given document > > For the list : > * I should have a index.js file in lists directory for the list with a > function like : > > function(head, row, req, info) { >  // !json templates.index >  // !code vendor/couchapp/path.js >  // !code vendor/couchapp/date.js >  // !code vendor/couchapp/template.js > >  return respondWith(req, { >    html : function() { >      if (head) { >        return template(templates.index.head, { >          assets : assetPath(), >        }); >      } else if (row) { >        var fav = row.value; >        return template(templates.index.row, { >          title : fav.title, >          description : fav.description, >          url : fav.url >        }); >      } else { >        return template(templates.index.tail, { >            assets : assetPath(), >        }); >      } >    }, >  }) > }; > > This mean that I have a templates/index/{head|row|tail}.html files. I just > adapted the one of sofa with removing "useless" code in my case > > If I understand well, that's all I need with an url like : > http://localhost:5984/monapp/_list/mycouchapp/index/ url is wrong it is on the format : /yourdb/_design/somedesigndoc/_list/nameoflist/nameofview > Url is something like : http://localhost:5984/monapp/_show/mycouchapp/fav/ > <_id> > again it should be /yourdb/_design/somedesigndoc/_show/nameofshow/id > What annoys me is the 404 status for all pages and that from the html > template point of views, I do not see JS that will "talk" to CouchDB > server/instance. There is something "magical" I can't get so far. > > As I did not find so far examples from ground/scratch for building lists / > shows, I ask for some help. > > Thanks in advance, > Nicolas > > PS : On #couchdb, #couchapp, you can find me with the login NiCoS` > PS2 : do not know it it's more a couchapp or couchdb issue - think > it's more couchdb one... > -- This just the urls you user that are wrong. Since I wrote my posts uri layhout have changed. I will post something about it tomorrow on my web. - benoît