Skip to content

Instantly share code, notes, and snippets.

@irrationalistic
Last active August 29, 2015 14:07
Show Gist options
  • Save irrationalistic/9473fa8f40f6242d5626 to your computer and use it in GitHub Desktop.
Save irrationalistic/9473fa8f40f6242d5626 to your computer and use it in GitHub Desktop.
extends layout
block content
h1 Hello Boulder!
script.
var names = !{JSON.stringify(data)};
script(src="main.js")
var MonsterA = function(name){
this.name = name;
};
var MonsterB = function(name){
this.name = name;
};
console.log(names);
var monsters = names.map(function(dataObject){
if(dataObject.class === 'a')
return new MonsterA(dataObject.name);
else
return new MonsterB(dataObject.name);
});
console.log(monsters);
var indexController = {
index: function(req, res) {
var data = [
{class: 'a', name: 'I Am A'},
{class: 'b', name: 'I am B'}
];
res.render('index', {
data: data
});
}
};
module.exports = indexController;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment