This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/:page?', function(req,res){ | |
var page = req.params.page, data; //page = requrest(:page) | |
if(!page) page = 'home'; // page = home by default | |
data = storage[page]; | |
if(!data) res.redirect('/') return; | |
data.links = Object.keys(store); | |
res.render('index', data); | |
}) | |
var storage = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Nightmare = require('nightmare'); | |
var fs = require('fs'); | |
var getContent = function(i, data) { | |
var i = i || 0; | |
if(i < data.length) { | |
var n = new Nightmare() | |
.useragent("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36") | |
.goto(data[i]) | |
.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const summation = x => Number.isInteger(x) ? x * (x + 1)/2 : 'Invalid Value'; | |