Created
September 22, 2015 04:12
-
-
Save prozbik/eb32d299a5fac0d67f23 to your computer and use it in GitHub Desktop.
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 = { | |
home: { | |
page: 'Home page', | |
content: 'content for home page' | |
}, | |
about: { | |
page: 'About page', | |
content: 'Some cool content for about page' | |
} | |
} | |
} | |
//by sorax fro screencast 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment