diff options
Diffstat (limited to 'main.js')
-rwxr-xr-x | main.js | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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); |