Skip to content

add dynamic rewriting

username-removed-47203 requested to merge pull/14/rewrite_fun into master

this change add the possibility to pass a function inside the list of rewrites rules instead of an object.

The function is expected to return a new list of rewrites rule. A rewrite function take the request as argument. This can be useful to return a list of path based on a request (like returning paths alowed for a user).

Ex:

 {
    "_id": "_design/test",
    "rewrites": [
         "function(req) { return  [{\"from\": \"/db\", \"to\": \"../..\"}]; }"
    ]
}

Merge request reports