summaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'main.js')
-rwxr-xr-xmain.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/main.js b/main.js
index 4b25c4e..1f26faa 100755
--- a/main.js
+++ b/main.js
@@ -1,5 +1,8 @@
#! /usr/bin/env node
+var path = require('path');
+var logging = require('node-logging');
+var express = require('express');
var args = require('optimist')
.usage('Usage: $0 -c configuration [-h]')
.default('c', './config')
@@ -12,23 +15,22 @@ if(args.h) {
return;
}
-var path = require('path');
-
process.on('uncaughtException', function(err) {
console.error('uncaughtException: ' + (err.stack || err.message || err.toString()));
});
process.chdir(__dirname);
+
var config = require('./config');
+logging.setLevel(config.logLevel || 'info');
-var express = require('express');
var app = express();
-
-app.use(express.logger());
+app.use(logging.requestLogger);
app.use(express.staticCache());
app.use(express.static(path.join(__dirname, config.Config.rootDir)));
-
config.Config.app = app;
+config.Config.logger = logging;
+
var model = require('./model_' + config.modelBackend);
model.start(config.Config);