Couchapp directory structure, updates?
Asked Answered
C

3

6

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!

Callicrates answered 12/4, 2011 at 0:29 Comment(1)
Well, now, after having updated CouchApp (yes, I should have dne that before :/ ), the Structure looks like this: '├── _attachments ├── lists ├── shows ├── updates └── views'Callicrates
A
4

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.

Amesace answered 12/4, 2011 at 11:2 Comment(2)
Wow, I never thought it could start so easily thanks for the _id tip. Always scratched my head and ran screaming from couchapp initAsleyaslope
i really don't think this is the best answer. check out the one below: #5629575Angelinaangeline
T
4

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:

Hope they help.

Trina answered 4/7, 2011 at 10:5 Comment(0)
O
3

Update functions are documented in the CouchDB wiki. Quoting it:

[...] you should think about an _update handler as complementary to _show functions, not to validate_doc_update functions.

Evently is documented on CouchApp site. Documentation is weak, I am using it in a project and I have found only a short blog post with useful info. Luckily the source code is easy to understand. But look at Pages app for sample usage. Anyway it is not clear to me how much used is it.

Oceanus answered 13/4, 2011 at 18:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.