Version 0.3.3 - Add of links
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Neutral/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Neutral/pipeline/head This commit looks good
				
			This commit is contained in:
		
							
								
								
									
										23
									
								
								routes/link.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								routes/link.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
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;
 | 
			
		||||
    }
 | 
			
		||||
   
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user