Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

properly serve and cache static assets

  • Loading branch information...
commit d442562ec2f9fe45ad8505a9667b149409e45a7f 1 parent b3e7f6f
@jazzychad authored
Showing with 2 additions and 19 deletions.
  1. +2 −19 app.js
View
21 app.js
@@ -22,27 +22,10 @@ app.set('view engine', 'jade');
app.set('view options', {layout: false});
app.use(express.bodyParser());
var oneYear = 31557600000;
-app.use(express.static('/', { maxAge: oneYear }));
+app.use(express.static(__dirname + '/', { maxAge: oneYear }));
+app.use(app.router);
app.use(express.errorHandler());
-var resources = [
- '/bootstrap/css',
- '/bootstrap/js',
- '/bootstrap/img',
- '/css',
- '/js',
- '/img'
-];
-for(var i = 0; i < resources.length; i++) {
- app.get(resources[i] + '/:file', function(req, res) {
- fs.readFile('.' + req.url,
- function(err, data) {
- if(err) res.end('', 404);
- else res.end(data);
- });
- });
-}
-
function render(type, res, o, callback) {
programDb.sort('date', function(err, recent) {
recent.moment = moment;
Please sign in to comment.
Something went wrong with that request. Please try again.