couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Antivackis <patrick.antivac...@gmail.com>
Subject Re: REST, Hypermedia, and CouchApps
Date Wed, 25 Feb 2009 10:35:29 GMT
Very interesting Chris,
Personnally, I not yet to use CouchApp nor _show nor _ list in a real
projects, but i have played with in order to see how it's working.
Also a  a background i played also with sling (
http://incubator.apache.org/sling) that is (purist please it's just to
simplify) a restful framework on top of JCR like Jackrabbit.
For my projects, i still stick to a custom php mvc framework on top of
couchDB.
Based on these experiences i find CouchApp interesting but still lacking
"usability" and "friendness"

First of all concerning the points you are pointing to :

One way to fix this it to give the resources made available by a
> design document a common root. This means we can use hrefs like
> "_show/docid" to link to a show function from an attachment.  So we
> get paths like this:
>
> /db/_design/foo/_view/bar?limit=10
> /db/_design/foo/_show/docid
> /db/_design/foo/index.html
>
> The downside is that the URLs are longer (and that the change would
> break all clients), the upside is the ability to link from one to the
> other (and thus be part of the web).


I think you describe good solution as far as you want to keep CouchApp non
intrusive to CouchDB.
I would add as a downside that URL are becoming uglier (or non friendly).

If it can be more intrusive, the best would be (at least for html document)
a regexp like function in CouchDB to set the <base> allowing to use relative
url afterwards.

== A related question ==
>
> The question raised by all of this is how closely do we want CouchDB
> to be intertwined with CouchApp?


I will make a stupid answer but for sure the more intrusive it is the easier
it will be to tweak  CouchDB
Also if not intrusive, some basic views (if we could retrieve _design docs
in a view) could be created by people using CouchApp in order to
automatically retrieve the apps to show in Futon.

Now what i think would be great for CouchApp (based on more intrusive
CouchApp) would be to make the url prettier

permit the call of /db/_show/tinydesigndocid/functionname/docid?format=xml
or /db/_show/tinydesigndocid/functionname/docid?format=html or
/db/_show/tinydesigndocid/functionname/docid?format=wap
by  db/tinydesigndocid/functionname/docid.xml
db/tinydesigndocid/functionname/docid.html
/db/tinydesigndocid/functionname/docid.wap the algo would be CouchDB try to
get tinydesigndocid/functionname/docid.xml in the base db, if not found it
will try to find _show/tinydesigndocid/functionname/docid and the extension
would be passed in the request object
being able to specify multiple aliasid  in a document that would point to a
designdoc and a functionname to apply to the doc, the mapping between
aliasid tinydesigndocid/functionname/docid being easy to catch through a
view
being able to remove the _list for the list

The whole idea is to allow the use of "pretty url" with couch using an algo
to map to the good docid, show docid, or list.

An other improvement (still intrusive) is to permit to define in _show and
_list a list of view/list/ whose results would be passed to the _show and
_list called function in order to give more power to these functions.

In fact, i implemented all these functionnalities (plus security,  plus....)
in the php mvc i'm using, and it tends to be quite efficient, but not as
much as if it were included in couchApp already.

Regards

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message