Thanks for your efforts, ermouth

I have been playing with it using the community AMI you put up adn it works 
just great.
It is a big step forward for couchapps since it is not possible to 
use username, or role from userCtx in rewrite rules
you can use the users IP address to firewall your system
you can redirect from GET to PUT
by going from a simple path, pick up username from userCtx, add timestamp and 
other context info you have a lot to play with
doing so by pointing to a _update function expands the possibilities further
creating nested rules is really easy
using regExp offers another host of possibilities
since you can return a http code and body directly, you can skip creating pages 
for common respons. A simple template function and the this.template[whatever] 
that is sitting in your ddoc will do in most cases, especially having usrCtx 
available

What I did was to create a EC2 instannce, redirect traffic on port 80 directly 
to CouchDB 2, set up a few vhosts and their corresponding design documents.
I always set up a design document to the the API for my app or system of apps 
and it feels akward to speak of a rewrite handler after this.

_rewrite concecptual upgrade #1
*************************************
At least we now have a router management system.
It would be easy to implement your favourite router in the CouchDB _rewrite, 
making nice isomorphic sollutions

_rewrite concecptual upgrade #2
*************************************
I woud call my first experiment an API server. Inside a ddoc, yes. 
The simplicity is a bit hard to grasp.
The power of this simplicity is even hard to grasp.

I hope there is someone that would pick up where ermouth left this and push it 
through testing so it could be released with 2.0
It unlocks a lot of the hidden power of couchapps, and with the Pouch based 
tools Ddoc Lab and Inliner that ermouth has made for the site builder and 
content people, this is a very low barrier of entry to CouchDB for new 
developers.

Johs




> On 16. okt. 2015, at 14.19, ermouth <ermo...@gmail.com> wrote:
> 
> Closing proposal off.
> 
> If someone wants to carry it on, current state is:
> 
> https://github.com/ermouth/couchdb-chttpd/commit/8e50451aec2b07f95b9115dddc9b33b512651026
> https://github.com/ermouth/couchdb-couch/commit/54b4324eeefe27431f5b42a89226b1ea63e17eb6
> https://github.com/ermouth/couchdb/commit/4d2d91ed67ed982ff2667cafa5c308e1a95350bc
> https://github.com/ermouth/couchdb-couch-mrview/commit/ae7ff262a8ace666891d6c9af5386ed2d1910303
> 
> It all works pretty fine and tested, but with own tests, since I was unable
> to overcome CouchDB test set in reasonable time – so no PR.
> 
> Current syntax example:
> 
> rewrites: function(req) {
>  // req is similar to req obj in list fn, but without .id, .info, .uuid,
> .form
>  return {
>   // path is mandatory
>   path:"/some/path?with=query&some=params",
>   // other fields are optional
>   headers:{/*headers go here*/},
>   method:"POST",
>   code:404,
>   body:JSON.stringify([1,2,3])
>  }
> }
> 
> ermouth

Reply via email to