Open 3rd-Eden opened 11 years ago
I just spent a bit of time on this and it looks as though connect's static
makes this very difficult, which I guess is part of the reason https://github.com/3rd-Eden/versions/issues/4 already exists. haha.
Anyway, I don't really see any way to do this sanely without first rewriting static
, but here is the code I came up with for recursively parsing the new format for the max age
option:
Versions.prototype.parse = function parse(nr, options) {
if (+nr && !options) return +nr;
if ( 'object' !== typeof nr ){
return ms(nr, options);
}
Object.keys(nr).forEach(function (key) {
this[key] = parse(this[key], options);
}, nr);
return nr;
};
This allows a much more flexible caching then currently available.