Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couchapp directory structure, updates?

when generating a new couchapp, I get this structure:

appname
├── _attachments
│   └── style
├── evently
│   ├── items
│   │   └── _changes
│   └── profile
│       └── profileReady
│           └── selectors
│               └── form
├── lists
├── shows
├── updates
├── vendor
│   └── couchapp
│       ├── _attachments
│       ├── evently
│       │   ├── account
│       │   │   ├── adminParty
│       │   │   ├── loggedIn
│       │   │   ├── loggedOut
│       │   │   ├── loginForm
│       │   │   │   └── selectors
│       │   │   │       └── form
│       │   │   └── signupForm
│       │   │       └── selectors
│       │   │           └── form
│       │   └── profile
│       │       ├── loggedOut
│       │       ├── noProfile
│       │       │   └── selectors
│       │       │       └── form
│       │       └── profileReady
│       └── lib
└── views
    └── recent-items

Now, since this structure is meant to reflect the JSON structure of a CouchDB _design document, I figured this out:

  • [_attachments] Attachments are stored binary. JavaScript, CSS, and HTML files are stored here.

  • [evently] ???

  • [lists] Lists are JavaScript functions that are executed to render HTML or AtomFeeds from view results.

  • [shows] Show functions are the analogue to list functions, but render content by transforming a document into other formats (such as html, xml, csv, png).

  • [updates] ???

  • [vendor]Home of external libraries.

  • [views]View contain MapReduce functions that can later be queried though the HTTP API (see \ref{couchdb:views}).

Appart from me hopefully being not completely wrong with the filled out descriptions, how would I describe the updates directory? Is this hosting validation functions?

The second question would be how you would describe the evently directory...

If there is a summary for this already existing, please point me to it!

Kind Regards!

like image 286
chris polzer Avatar asked Apr 12 '11 00:04

chris polzer


2 Answers

The generate command builds the backbone document format that CouchDB needs; and it also builds a web app development framework, Evently. I don't know Evently very well; but basically it gives a developer tools and suggestions to make the UI and the couch interact.

Personally, I never use the couchapp generate command. I just create the _id file from scratch (echo -n _design/whatever > _id), then create folders and files as I need them.

List functions (one per file) receive _view output to produce any HTTP response (e.g. XML RSS).

Show functions (one per file) receive a one document to produce any HTTP repsonse.

Update functions (one per file) receive one HTTP query and output one prepared document to be stored by couch. (For example, receiving a form submission and building a JSON document.)

View functions (one map.js and one reduce.js in a folder) are CouchDB views and provide for the querying and stuff.

I'm not sure about updates and vendor. They aren't relevant to the CouchDB server.

like image 157
JasonSmith Avatar answered Oct 12 '22 20:10

JasonSmith


I have been using couchapp for about a week or two now. It took me more than a while to get the grasp of how couchDB works and how couchapp fits. In fact, I was having the very questions that you were having and I'm sure now that every newbie to couchapp will have these questions lingering in their mind. To save their time at least, I'm posting some of the links that helped be get better at answering the very questions you have asked for. And the links are as below:

  • http://couchapp.org/page/filesystem-mapping
  • http://couchapp.org/page/couchapp-usage
  • http://couchapp.org/page/evently-do-it-yourself
  • http://www.ibm.com/developerworks/opensource/tutorials/os-couchapp/?ca=drs-

Hope they help.

like image 29
karthiks Avatar answered Oct 12 '22 21:10

karthiks