Refactoring for deployment

Renamed view field in routes to “name” to match scratch-www, not using “view” field because all scratchJr views are name/name.jsx

renamed server to dev-server, and app.js to index.js for consistency with www, and to make clear it’s only the way it runs in development.

Added html-webpack-plugin
This commit is contained in:
chrisgarrity 2016-09-21 13:02:23 -04:00
parent 595a5a3093
commit a2125b48c9
9 changed files with 136 additions and 44 deletions
dev-server

22
dev-server/handler.js Executable file
View file

@ -0,0 +1,22 @@
/**
* Constructor
*/
function Handler (route) {
// Handle redirects
if (route.redirect) {
return (req, res) => { res.redirect(route.redirect); };
}
var url = '/' + route.name + '.html';
return function (req, res, next) {
req.url = url;
next();
};
}
/**
* Export a new instance
*/
module.exports = function (route) {
return new Handler(route);
};