From a3f8989a1c590d2cdbbc6a04bef6072a0038ec1b Mon Sep 17 00:00:00 2001 From: Seth Woodworth Date: Mon, 12 Mar 2012 17:54:34 -0400 Subject: [PATCH] set a maxAge timeout on static files and setting up an error log for res.sendfile --- app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; }, -- 2.25.1