I have a scenario where I can pass a function or have it declared already. Since the function itself is not going to be used anywhere else I was planning to use an anonymous function instead, but the thing it's not working, so any help will be greatly appreciated.
As it is right now:
function connectStatic(connect, dir) {
return connect.static(require('path').resolve(dir));
}
// ...
middleware: function (connect) {
return [proxySnippet, connectStatic(connect, './')];
}
// ...
As I would like it to be:
// ...
middleware: function (connect) {
return [proxySnippet, function () {
return connect.static(require('path').resolve('./'));
}];
// ...
Anyway, if I do:
// ...
middleware: function (connect) {
return [proxySnippet, connect.static(require('path').resolve('./'))];
// ...
...it will works, but I'm wondering why it doesn't with the function declaration.