From: Seth Woodworth Date: Mon, 12 Mar 2012 21:54:34 +0000 (-0400) Subject: set a maxAge timeout on static files and setting up an error log for res.sendfile X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a3f8989a1c590d2cdbbc6a04bef6072a0038ec1b;hp=b17da3c08d4be0824c0be192619b70e4082932aa;p=oweals%2Ffinalsclub.git set a maxAge timeout on static files and setting up an error log for res.sendfile --- diff --git a/app.js b/app.js index b899bda..ebaaecc 100644 --- a/app.js +++ b/app.js @@ -161,7 +161,7 @@ app.configure(function(){ // requests that otherwise aren't handled by default. app.use( express.methodOverride() ); // Static files are loaded when no dynamic views match. - app.use( express.static( __dirname + '/public' ) ); + app.use( express.static( __dirname + '/public', {maxAge: 900000} ) ); // Sets the routers middleware to load after everything set // before it, but before static files. @@ -441,7 +441,11 @@ function checkAjax( req, res, next ) { if ( req.xhr ) { next(); } else { - res.sendfile( 'public/index.html' ); + res.sendfile( 'public/index.html', function(err){ + if(err){ + console.log(err); + } + }); } } @@ -455,7 +459,6 @@ app.dynamicHelpers( { // during rendering, this allows you to use the // user object if available in views. 'user' : function( req, res ) { - console.log("When the fuck is a dynamic helper used?"); return req.user; },