abemassry
0 Likes 0 Comments javascriptapp.get('/code/:id', function(req, res){
if (req.user) {
var username = req.user.username;
}
//if (app.requireAuth === true && req.loggedIn === false)
//res.redirect('/auth/twitter');
//get the example
models.codes.findById(req.params.id, function(err, data){
if (data) {
models.users.findOne({name: username}, function(err, userdata){
//render the view page
res.render('code.jade', {
locals: {
title: data.title,
page: '',
code: data,
user: username,
userdata: userdata
}
});
});
} else {
res.redirect('/404');
}
});
});
created with codestagram