couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harald Kisch <haraldki...@gmail.com>
Subject Re: [PROPOSAL] Allow rewrites to be JS function
Date Sat, 17 Oct 2015 19:20:30 GMT
Johs, thank you for testing the amazing features unlocked by ermouth.
Now it would be great to monk this up to the release of CouchDB 2.0.
This new feature sets are a great cntribution for the community and all
couchappers.
I am very excited about the outcome of ermouth's work. He saw it, figured
it out what to do, and did it.
Thank you for this ermouth.
+100

On Sat, Oct 17, 2015 at 4:45 PM, Johs Ensby <johs@b2w.com> wrote:

> 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 <ermouth@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
>
>


-- 

Dipl.-Inf. Harald R. Kisch

Büro besetzt von Di - Do 9:00 Uhr bis 18:00 Uhr
Jahnstr. 3
80469 München
Germany

Tel: +49 (0) 89 41 61 58 57-6
Mobil DE: +49 (0) 176 56 58 58 38

Skype: harald.kisch
Mail: haraldkisch@gmail.com

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