compoxure
compoxure copied to clipboard
JS function parameter for backend configuration
For different backends I have definded JS-functions. This functions are called with two parameters:
req.backend = _.find(config.backend, function(server) {
if (server.pattern) { return new RegExp(server.pattern).test(req.url); }
if (server.fn) {
if (typeof config.functions[server.fn] == 'function') {
return config.functions[server.fn](req, req.templateVars);
}
}
});
For my situation it would be good to have the current config also as a parameter.
return config.functions[server.fn](req, req.templateVars, server);
Then it is possible for me to add own configurations and to check against them in my JS-function.
What do you think about it?
Definitely - its a good idea, and an oversight really. Are you able to submit a PR?
Yes I'll submit a PR in the next days.
@sithmel we should do this.