Dear couchappers!

My collegues created Amazon EC2 AMI image with Ubuntu 14.04 and CouchDB
2.0.4ca9e41 + JS-rewrite patches applied over it. AMI image is publically
available under AMI ID ami-29ecda5e (section ‘Community AMIs’).

You can launch your own instance from this AMI and have empty CouchDB2
(with JS rewrites) auto-launched in single-node mode. When creating your
EC2 instance do not forget to allow access to your instance from your IP
(create Security Group with appropriate network settings).

Short specs
------------

Any design doc for this fork can have .rewrite section, defined as a
string, containing function. ‘Classic’ array format is surely also
supported.

Rewrite function receives one argument, req2 object, that is lean version
of req object for list functions. Unlike lists, rewrite function‘s req2 obj
does not have properties .id, .uuid, .info, .requested_path and .form. All
other properties are in place.

Rewrite function must return object of structure {path:String,
method:String, code:Number, headers:Object, body:String}. The property
.path is mandatory, all other properties are optional.

Some hints on usage
------------

Using js rewrites you can, for example:
* create per-user DBs from non-admin requests;
* allow users to self-register;
* have fair multi-user shared DBs with restricted replication;
...etc.

Will be happy to hear other scenarios from you! Play with it and explore
boundaries of the feature.

Please, feel free to ask questions.

BR,
ermouth

PS. Code was reviewed by @kxepal (Alexander, thank you for it!), and
received several not yet fixed non-critical remarks. I‘m working on
cleaning em up. Please note: this preview is NOT intended for production
and does not support Erlang rewrite fns, only JS.

Reply via email to