fixed comma error for merge.
This commit is contained in:
44
app.js
44
app.js
@ -15,6 +15,7 @@ process.on('uncaughtException', function (err) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var express = require('express'),
|
var express = require('express'),
|
||||||
|
accepts = require('accepts'),
|
||||||
cookieParser = require('cookie-parser'),
|
cookieParser = require('cookie-parser'),
|
||||||
compress = require('compression'),
|
compress = require('compression'),
|
||||||
session = require('express-session'),
|
session = require('express-session'),
|
||||||
@ -524,17 +525,54 @@ app.get(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//put this route last
|
app.get('/induce-vomiting', function(req, res, next) {
|
||||||
|
next(new Error('vomiting induced'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// put this route last
|
||||||
app.get(
|
app.get(
|
||||||
'/:username',
|
'/:username',
|
||||||
userController.returnUser
|
userController.returnUser
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 500 Error Handler.
|
* 500 Error Handler.
|
||||||
*/
|
*/
|
||||||
app.use(errorHandler());
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
app.use(errorHandler({ log: true }));
|
||||||
|
} else {
|
||||||
|
// error handling in production
|
||||||
|
app.use(function(err, req, res, next) {
|
||||||
|
|
||||||
|
// respect err.status
|
||||||
|
if (err.status) {
|
||||||
|
res.statusCode = err.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// default status code to 500
|
||||||
|
if (res.statusCode < 400) {
|
||||||
|
res.statusCode = 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse res type
|
||||||
|
var accept = accepts(req);
|
||||||
|
var type = accept.type('html', 'json', 'text');
|
||||||
|
|
||||||
|
var message = 'opps! Something went wrong. Please try again later';
|
||||||
|
if (type === 'html') {
|
||||||
|
req.flash('errors', { msg: message });
|
||||||
|
return res.redirect('/');
|
||||||
|
// json
|
||||||
|
} else if (type === 'json') {
|
||||||
|
res.setHeader('Content-Type', 'application/json');
|
||||||
|
return res.send({ message: message });
|
||||||
|
// plain text
|
||||||
|
} else {
|
||||||
|
res.setHeader('Content-Type', 'text/plain');
|
||||||
|
return res.send(message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Express server.
|
* Start Express server.
|
||||||
|
@ -2,7 +2,7 @@ var _ = require('lodash'),
|
|||||||
debug = require('debug')('freecc:cntr:bonfires'),
|
debug = require('debug')('freecc:cntr:bonfires'),
|
||||||
Bonfire = require('./../models/Bonfire'),
|
Bonfire = require('./../models/Bonfire'),
|
||||||
User = require('./../models/User'),
|
User = require('./../models/User'),
|
||||||
resources = require('./resources')
|
resources = require('./resources'),
|
||||||
MDNlinks = require('./../seed_data/bonfireMDNlinks');
|
MDNlinks = require('./../seed_data/bonfireMDNlinks');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
"postinstall": "node seed_data/seed.js"
|
"postinstall": "node seed_data/seed.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"accepts": "^1.2.5",
|
||||||
"async": "^0.9.0",
|
"async": "^0.9.0",
|
||||||
"bcrypt-nodejs": "^0.0.3",
|
"bcrypt-nodejs": "^0.0.3",
|
||||||
"body-parser": "^1.9.3",
|
"body-parser": "^1.9.3",
|
||||||
|
"chai-jquery": "^2.0.0",
|
||||||
"cheerio": "^0.18.0",
|
"cheerio": "^0.18.0",
|
||||||
"clockwork": "^0.1.1",
|
"clockwork": "^0.1.1",
|
||||||
"compression": "^1.2.1",
|
"compression": "^1.2.1",
|
||||||
|
@ -185,7 +185,7 @@
|
|||||||
"tests": [
|
"tests": [
|
||||||
"assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');",
|
"assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');",
|
||||||
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
|
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
|
||||||
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return cthe last chunk as remaining elements');"
|
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');"
|
||||||
],
|
],
|
||||||
"MDNlinks" : ["Array.push()"]
|
"MDNlinks" : ["Array.push()"]
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user