From 779adde846e7111ef43628a32eead81024f0ce0b Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Sat, 14 Feb 2015 01:51:28 +0000 Subject: [PATCH] Quality control --- .jshintrc | 3 +++ app.js | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..6cf513e --- /dev/null +++ b/.jshintrc @@ -0,0 +1,3 @@ +{ + "node": true +} \ No newline at end of file diff --git a/app.js b/app.js index cea09cb..de4ec6c 100644 --- a/app.js +++ b/app.js @@ -62,7 +62,7 @@ if (development) { app.get('*', function(req,res,next) { // force SSL if (req.headers['cf-visitor'] && req.headers['cf-visitor'] != '{"scheme":"https"}') { - return res.redirect("https://" + req.headers['host'] + req.url); + return res.redirect("https://" + req.headers.host + req.url); } else if (req.headers['cf-visitor']) { req.userProtocol = "https"; } else { @@ -84,7 +84,7 @@ app.get('/recent', function(req, res, next) { req.db.matches.find().sort({created_at:-1}).limit(6).toArray().then(function(docs){ var recents = []; docs.forEach(function(doc) { - recents.push(doc.services[doc._id.split("$$")[0]]) + recents.push(doc.services[doc._id.split("$$")[0]]); }); res.json({recents:recents}); }).catch(function (error) { @@ -105,10 +105,10 @@ app.use(function(req, res, next) { // will print stacktrace if (app.get('env') === 'development') { app.use(function(err, req, res, next) { - console.log(err.stack) + console.log(err.stack); res.status(err.status || 500); - var content = React.renderToString(ErrorView({status: err.status || 500, message: err.message, error: err})); + var content = React.renderToString(new ErrorView({status: err.status || 500, message: err.message, error: err})); res.send('\n' + content); }); } @@ -118,7 +118,7 @@ if (app.get('env') === 'development') { app.use(function(err, req, res, next) { res.status(err.status || 500); - var content = React.renderToString(ErrorView({status: err.status || 500, message: err.message, error: {status: err.status || 500}})); + var content = React.renderToString(new ErrorView({status: err.status || 500, message: err.message, error: {status: err.status || 500}})); res.send('\n' + content); });