Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxAge is incorrect in express-configuration #1

Open
JosephScript opened this issue Jun 17, 2015 · 0 comments
Open

maxAge is incorrect in express-configuration #1

JosephScript opened this issue Jun 17, 2015 · 0 comments

Comments

@JosephScript
Copy link

In the file express-configuration/index.js the maxAge is logged as one day but in reality is set to one year.

console.log("Setting 'Public' folder with maxAge: 1 Day.");
    var publicFolder = path.dirname(module.parent.filename)  + "/public";
    var oneYear = 31557600000;
    app.use(express.static(publicFolder, { maxAge: oneYear }));

Since setting public cache to one year is the maximum recommended, I suggest changing the log to the following:

console.log("Setting 'Public' folder with maxAge: 1 Year.");
    var publicFolder = path.dirname(module.parent.filename)  + "/public";
    var oneYear = 31557600000;
    app.use(express.static(publicFolder, { maxAge: oneYear }));

The other option is to use 86400000 milliseconds such as the following:

console.log("Setting 'Public' folder with maxAge: 1 Day.");
    var publicFolder = path.dirname(module.parent.filename)  + "/public";
    var oneDay = 86400000;
    app.use(express.static(publicFolder, { maxAge: oneDay }));

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant