23 lines
480 B
JavaScript
23 lines
480 B
JavaScript
|
var express = require('express');
|
||
|
var router = express.Router();
|
||
|
var path = require("path")
|
||
|
|
||
|
module.exports = router;
|
||
|
|
||
|
|
||
|
module.exports.ApplyLinks = class {
|
||
|
constructor(links) {
|
||
|
// Remove all routes
|
||
|
router.stack = []
|
||
|
|
||
|
for(var link of links) {
|
||
|
const url = link.url
|
||
|
router.get("/" + link.dest, (req,res,next) => {
|
||
|
res.redirect(302, url)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
module.exports = router;
|
||
|
}
|
||
|
|
||
|
}
|