mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-08-28 22:12:19 -04:00
Added code for redirects and now redirecting the donation URL to the proper location. Fixes #412.
This commit is contained in:
parent
10455f980f
commit
cbc58d2f11
3 changed files with 11 additions and 3 deletions
|
@ -10,6 +10,11 @@ var config = require('./config');
|
|||
* Constructor
|
||||
*/
|
||||
function Handler (route) {
|
||||
// Handle redirects
|
||||
if (route.redirect) {
|
||||
return (req, res) => res.redirect(route.redirect);
|
||||
}
|
||||
|
||||
// Route definition
|
||||
defaults(route, config);
|
||||
|
||||
|
|
|
@ -45,10 +45,9 @@ app.use(function (req, res, next) {
|
|||
});
|
||||
|
||||
// Bind routes
|
||||
for (var routeId in routes) {
|
||||
var route = routes[routeId];
|
||||
routes.forEach(route => {
|
||||
app.get(route.pattern, handler(route));
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof process.env.NODE_SENTRY_DSN === 'string') {
|
||||
var raven = require('raven');
|
||||
|
|
|
@ -43,5 +43,9 @@
|
|||
"pattern": "/wedo",
|
||||
"view": "wedo2",
|
||||
"title": "LEGO WeDo 2.0"
|
||||
},
|
||||
{
|
||||
"pattern": "/info/donate/",
|
||||
"redirect": "https://secure.donationpay.org/scratchfoundation/"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue