mirror of
https://github.com/scratchfoundation/scratchjr-website.git
synced 2025-08-13 23:10:17 -04:00
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:
parent
595a5a3093
commit
a2125b48c9
9 changed files with 136 additions and 44 deletions
dev-server
22
dev-server/handler.js
Executable file
22
dev-server/handler.js
Executable 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);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue