add new relic and potentially fix the challenges controller
This commit is contained in:
@ -2,17 +2,26 @@
|
||||
* GET /
|
||||
* Challenges.
|
||||
*/
|
||||
var Challenge = require('./../models/Challenge')
|
||||
var Challenge = require('./../models/Challenge');
|
||||
var _ = require('lodash');
|
||||
|
||||
exports.returnChallenge = function(req, res) {
|
||||
Challenge.findOne({challengeNumber: req.params.challengeNumber}, function(err, c){
|
||||
exports.returnChallenge = function(req, res, next) {
|
||||
var challengeNumber = req.params.challengeNumber;
|
||||
if (!_.isNumber(challengeNumber)) {
|
||||
challengeNumber = 0;
|
||||
}
|
||||
Challenge.findOne({challengeNumber: challengeNumber}, function(err, c){
|
||||
if (err) {
|
||||
console.error('Challenge err: ', err);
|
||||
next(err);
|
||||
}
|
||||
res.render('challenges/show', {
|
||||
title: 'Challenge',
|
||||
name: c.name,
|
||||
video: c.video,
|
||||
time: c.time,
|
||||
steps: c.steps,
|
||||
cc: req.user.challengesCompleted || []
|
||||
cc: req.user ? req.user.challengesCompleted : []
|
||||
});
|
||||
});
|
||||
};
|
24
newrelic.js
Normal file
24
newrelic.js
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* New Relic agent configuration.
|
||||
*
|
||||
* See lib/config.defaults.js in the agent distribution for a more complete
|
||||
* description of configuration variables and their potential values.
|
||||
*/
|
||||
exports.config = {
|
||||
/**
|
||||
* Array of application names.
|
||||
*/
|
||||
app_name : ['freecodecamp'],
|
||||
/**
|
||||
* Your New Relic license key.
|
||||
*/
|
||||
license_key : '4b88e7cef87e9e99728be2d36c4d5f2a3862f5ae',
|
||||
logging : {
|
||||
/**
|
||||
* Level at which to log. 'trace' is most useful to New Relic when diagnosing
|
||||
* issues with the agent, 'info' and higher will impose the least overhead on
|
||||
* production applications.
|
||||
*/
|
||||
level : 'info'
|
||||
}
|
||||
};
|
@ -28,6 +28,7 @@
|
||||
"express-validator": "^2.6.0",
|
||||
"fbgraph": "^0.2.11",
|
||||
"github-api": "^0.7.0",
|
||||
"helmet": "^0.5.2",
|
||||
"instagram-node": "^0.5.1",
|
||||
"jade": "^1.7.0",
|
||||
"lastfm": "^0.9.2",
|
||||
@ -37,6 +38,7 @@
|
||||
"method-override": "^2.2.0",
|
||||
"mongoose": "^3.8.16",
|
||||
"morgan": "^1.3.1",
|
||||
"newrelic": "^1.13.3",
|
||||
"node-foursquare": "^0.2.1",
|
||||
"node-linkedin": "^0.3.3",
|
||||
"nodemailer": "^1.2.2",
|
||||
|
Reference in New Issue
Block a user