Update routes for all static pages and leave redirects for existing routes to get to new wiki routes

This commit is contained in:
Michael Q Larson
2015-03-30 15:15:07 -07:00
parent 660214f87e
commit 23a3e235a7
16 changed files with 412 additions and 622 deletions

View File

@ -78,87 +78,18 @@ module.exports = {
});
},
deployAWebsite: function deployAWebsite(req, res) {
res.render('resources/deploy-a-website', {
title: 'Deploy a Dynamic Website in 7 Minutes'
});
},
chat: function chat(req, res) {
res.render('resources/chat', {
title: "Enter Free Code Camp's Chat Rooms"
});
},
nonprofitProjectInstructions: function nonprofitProjectInstructions(req, res) {
res.render('resources/nonprofit-project-instructions', {
title: 'Nonprofit Project Instructions'
});
},
gmailShortcuts: function gmailShortcuts(req, res) {
res.render('resources/gmail-shortcuts', {
title: 'These Gmail Shortcuts will save you Hours'
});
},
guideToOurNonprofitProjects: function guideToOurNonprofitProjects(req, res) {
res.render('resources/guide-to-our-nonprofit-projects', {
title: 'A guide to our Nonprofit Projects'
});
},
chromebook: function chromebook(req, res) {
res.render('resources/chromebook', {
title: 'Win a Chromebook'
});
},
jqueryExercises: function jqueryExercises(req, res) {
res.render('resources/jquery-exercises', {
title: 'jQuery Exercises'
});
},
livePairProgramming: function(req, res) {
res.render('resources/live-pair-programming', {
title: 'Live Pair Programming'
});
},
installScreenHero: function(req, res) {
res.render('resources/install-screenhero', {
title: 'Install ScreenHero'
});
},
javaScriptInYourInbox: function(req, res) {
res.render('resources/javascript-in-your-inbox', {
title: 'JavaScript in your Inbox'
});
},
nodeSchoolChallenges: function(req, res) {
res.render('resources/nodeschool-challenges', {
title: 'NodeSchool Challenges'
});
},
trelloCalls: function(req, res, next) {
request('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(err, status, trello) {
if (err) { return next(err); }
trello = (status && status.statusCode == 200) ? (JSON.parse(trello)) : "Can't connect to to Trello";
res.end(JSON.stringify(trello));
});
},
bloggerCalls: function(req, res, next) {
request('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (err, status, blog) {
if (err) { return next(err); }
blog = (status && status.statusCode == 200) ? JSON.parse(blog) : "Can't connect to Blogger";
res.end(JSON.stringify(blog));
});
},
githubCalls: function(req, res) {
var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 };
request('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(err, status1, pulls) {
@ -177,6 +108,7 @@ module.exports = {
res.end(JSON.stringify(trello));
});
},
bloggerCalls: function(req, res, next) {
request('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (err, status, blog) {
if (err) { return next(err); }
@ -270,7 +202,6 @@ module.exports = {
});
},
randomPhrase: function() {
var phrases = resources.phrases;
return phrases[Math.floor(Math.random() * phrases.length)];
@ -300,6 +231,7 @@ module.exports = {
return elem._id;
});
},
allBonfireNames: function() {
return bonfires.map(function(elem) {
return {
@ -319,6 +251,25 @@ module.exports = {
});
},
allBonfireNames: function() {
return bonfires.map(function(elem) {
return {
name: elem.name,
difficulty: elem.difficulty,
_id: elem._id
}
})
.sort(function(a, b) {
return a.difficulty - b.difficulty;
})
.map (function(elem) {
return {
name : elem.name,
_id: elem._id
}
});
},
getAllCourses: function() {
"use strict";
return coursewares;
@ -338,6 +289,7 @@ module.exports = {
return elem._id;
});
},
allCoursewareNames: function() {
return coursewares.map(function(elem) {
return {
@ -356,9 +308,11 @@ module.exports = {
};
});
},
whichEnvironment: function() {
return process.env.NODE_ENV;
},
getURLTitle: function(url, callback) {
(function () {
var result = {title: '', image: '', url: '', description: ''};
@ -379,6 +333,7 @@ module.exports = {
});
})();
},
updateUserStoryPictures: function(userId, picture, username, cb) {
var counter = 0,