To avoid JSLint warning on var path being assigned but never used (it's used in eval()), putting a rather ugly solution directly into the the 'resolve' property of the routes.json

This commit is contained in:
Colby Gutierrez-Kraybill 2015-09-14 13:17:50 -04:00
parent 393552bd46
commit 2e1cd7b7d7
2 changed files with 3 additions and 4 deletions

View file

@ -1,6 +1,5 @@
var compression = require('compression');
var express = require('express');
var path = require('path');
var handler = require('./handler');
var log = require('./log');
@ -16,9 +15,9 @@ app.use(compression());
for (var item in routes) {
var route = routes[item];
if ( route.static ) {
app.use( express.static( eval( route.resolve ), route.attributes ) );
app.use( express.static( eval( route.resolve ), route.attributes ) );
} else {
app.get(route.pattern, handler(route));
app.get(route.pattern, handler(route));
}
}

View file

@ -17,7 +17,7 @@
},
{
"static": true,
"resolve": "path.resolve(__dirname, '../build')",
"resolve": "(function(){ var path = require('path'); return(path.resolve(__dirname, '../build'));})()",
"attributes": { "lastModified": true, "maxAge": "1y" },
"_todo": " TODO: Define a specification for how each entry is used/expected to look like, given the nginx conf generator's needs and stand-alone run-time needs. An outline of this so far: static requires resolve/attributes but could use pattern too. ..."
}