added connect-flash package. npm also alphabetically re-ordered the deps... thanks npm?

v1.18.x
Julian Lam 11 years ago
parent fb504473e1
commit 6f218857cb

@ -15,42 +15,43 @@
"test": "mocha ./tests -t 10000"
},
"dependencies": {
"async": "~0.2.8",
"bcryptjs": "~0.7.10",
"connect-flash": "^0.1.1",
"cron": "~1.0.4",
"daemon": "~1.1.0",
"express": "3.2.0",
"express-namespace": "~0.1.1",
"socket.io": "~0.9.16",
"socket.io-wildcard": "~0.1.1",
"passport": "~0.2.0",
"passport-local": "0.1.6",
"marked": "0.2.8",
"async": "~0.2.8",
"gm": "1.14.2",
"gravatar": "1.0.6",
"less": "~1.6.3",
"marked": "0.2.8",
"mkdirp": "~0.3.5",
"nconf": "~0.6.7",
"sitemap": "~0.7.3",
"winston": "~0.7.2",
"rss": "~0.2.0",
"request": "~2.34.0",
"nodebb-plugin-dbsearch": "0.0.9",
"nodebb-plugin-markdown": "~0.4.1",
"nodebb-plugin-mentions": "~0.5.0",
"nodebb-plugin-soundpack-default": "~0.1.1",
"nodebb-theme-lavender": "~0.0.26",
"nodebb-theme-vanilla": "~0.0.21",
"nodebb-widget-essentials": "~0.0.21",
"npm": "^1.4.6",
"passport": "~0.2.0",
"passport-local": "0.1.6",
"prompt": "~0.2.11",
"uglify-js": "git+https://github.com/julianlam/UglifyJS2.git",
"validator": "~3.4.0",
"cron": "~1.0.4",
"request": "~2.34.0",
"rimraf": "~2.2.6",
"rss": "~0.2.0",
"semver": "~2.2.1",
"sitemap": "~0.7.3",
"socket.io": "~0.9.16",
"socket.io-wildcard": "~0.1.1",
"string": "~1.7.0",
"xregexp": "~2.0.0",
"bcryptjs": "~0.7.10",
"less": "~1.6.3",
"daemon": "~1.1.0",
"uglify-js": "git+https://github.com/julianlam/UglifyJS2.git",
"underscore": "~1.6.0",
"mkdirp": "~0.3.5",
"rimraf": "~2.2.6",
"npm": "^1.4.6",
"nodebb-plugin-mentions": "~0.5.0",
"nodebb-plugin-markdown": "~0.4.1",
"nodebb-widget-essentials": "~0.0.21",
"nodebb-theme-vanilla": "~0.0.21",
"nodebb-theme-lavender": "~0.0.26",
"nodebb-plugin-soundpack-default": "~0.1.1",
"nodebb-plugin-dbsearch": "0.0.9"
"validator": "~3.4.0",
"winston": "~0.7.2",
"xregexp": "~2.0.0"
},
"devDependencies": {
"mocha": "~1.13.0"

@ -12,7 +12,9 @@ function createStatic(statusCode) {
res.statusCode = parseInt(statusCode, 10);
}
res.render(statusCode, {});
res.render(statusCode, {
errorMessage: req.flash('errorMessage')[0] || undefined
});
};
}

@ -14,6 +14,7 @@ var templates = require('./../../public/src/templates'),
nconf = require('nconf'),
express = require('express'),
winston = require('winston'),
flash = require('connect-flash'),
relativePath,
viewsPath,
@ -138,12 +139,13 @@ function handleErrors(err, req, res, next) {
// here and next(err) appropriately, or if
// we possibly recovered from the error, simply next().
console.error(err.stack);
var status = err.status || 500;
res.status(status);
res.json(status, {
error: err.message
});
req.flash('errorMessage', err.message);
res.redirect('500');
}
function catch404(req, res, next) {
@ -190,6 +192,7 @@ module.exports = function(app, data) {
app.engine('tpl', templates.__express);
app.set('view engine', 'tpl');
app.set('views', viewsPath);
app.use(flash());
app.enable('view cache');

Loading…
Cancel
Save