mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-11 08:11:19 -05:00
590f505a61
This reverts commit1b1b396e92
, reversing changes made toa144bab0e6
.
24 lines
431 B
JavaScript
24 lines
431 B
JavaScript
/*
|
|
* Constructor
|
|
*/
|
|
const Handler = function (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);
|
|
};
|