mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -05:00
53d3bb94dc
This reverts commit5ce1a9f411
, reversing changes made to5be4c45f08
.
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);
|
|
};
|