mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-29 18:46:20 -05:00
Adding annotations to routes.json and correct interpreting code to include information about static assets. Will be used by routes-to-nginx-conf for building nginx regex patterns
This commit is contained in:
parent
724551b40c
commit
393552bd46
3 changed files with 18 additions and 8 deletions
|
@ -39,6 +39,7 @@
|
||||||
"react": "0.13.3",
|
"react": "0.13.3",
|
||||||
"react-modal": "0.3.0",
|
"react-modal": "0.3.0",
|
||||||
"react-slick": "0.7.0",
|
"react-slick": "0.7.0",
|
||||||
|
"routes-to-nginx-conf": "0.0.2",
|
||||||
"sass-loader": "2.0.1",
|
"sass-loader": "2.0.1",
|
||||||
"slick-carousel": "1.5.8",
|
"slick-carousel": "1.5.8",
|
||||||
"style-loader": "0.12.3",
|
"style-loader": "0.12.3",
|
||||||
|
|
|
@ -11,16 +11,16 @@ var app = express();
|
||||||
app.disable('x-powered-by');
|
app.disable('x-powered-by');
|
||||||
app.use(log());
|
app.use(log());
|
||||||
app.use(compression());
|
app.use(compression());
|
||||||
app.use(express.static(path.resolve(__dirname, '../build'), {
|
|
||||||
lastModified: true,
|
|
||||||
maxAge: '1y'
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Bind routes
|
// Bind routes
|
||||||
for (var item in routes) {
|
for (var item in routes) {
|
||||||
var route = routes[item];
|
var route = routes[item];
|
||||||
|
if ( route.static ) {
|
||||||
|
app.use( express.static( eval( route.resolve ), route.attributes ) );
|
||||||
|
} else {
|
||||||
app.get(route.pattern, handler(route));
|
app.get(route.pattern, handler(route));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start listening
|
// Start listening
|
||||||
var port = process.env.PORT || 8888;
|
var port = process.env.PORT || 8888;
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"pattern": "/",
|
"pattern": "/",
|
||||||
"view": "splash"
|
"view": "splash",
|
||||||
|
"static": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "/about",
|
"pattern": "/about",
|
||||||
"view": "about",
|
"view": "about",
|
||||||
"title": "About"
|
"title": "About",
|
||||||
|
"static": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "/components",
|
"pattern": "/components",
|
||||||
"view": "components"
|
"view": "components",
|
||||||
|
"static": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"static": true,
|
||||||
|
"resolve": "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. ..."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue