Skip to content

Node.js based forum software built for the modern web

Merge branch 'master' of https://github.com/iamcardinal/NodeBB-enhancement into iamcardinal-merge

Julian Lam839649d42f20
diff --cc src/webserver.js
index a9b7488f90,ee87e0fa16..0b07f23f43
--- a/src/webserver.js
+++ b/src/webserver.js
@@@ -185,9 -134,57 +185,9 @@@ var express = require('express')
templates['logout'] = parsedTemplate;
});
- server.listen(nconf.get('PORT') || nconf.get('port'));
+ server.listen(nconf.get('PORT') || nconf.get('port'), nconf.get('bind_address'));
}
- auth.initialize(app);
-
- app.use(function (req, res, next) {
-
- nconf.set('https', req.secure);
-
- next();
- });
-
- app.use(app.router);
-
- app.use(function (req, res, next) {
- res.status(404);
-
- // respond with html page
- if (req.accepts('html')) {
- //res.json('404', { url: req.url });
- res.redirect(nconf.get('relative_path') + '/404');
- return;
- }
-
- // respond with json
- if (req.accepts('json')) {
- res.send({
- error: 'Not found'
- });
- return;
- }
-
- // default to plain-text. send()
- res.type('txt').send('Not found');
- });
-
- app.use(function (err, req, res, next) {
-
- // we may use properties of the error object
- // here and next(err) appropriately, or if
- // we possibly recovered from the error, simply next().
- console.error(err.stack);
-
- res.status(err.status || 500);
-
- res.json('500', {
- error: err.message
- });
- });
-
-
app.create_route = function (url, tpl) { // to remove
return '<script>templates.ready(function(){ajaxify.go("' + url + '", null, "' + tpl + '");});</script>';
};