summaryrefslogtreecommitdiff
path: root/main.js
blob: f52d1add5e9699467a6bcbe4f4f5245e97fb0158 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /usr/bin/env node

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');

var express = require('express');
var app = express();

app.use(express.logger());
app.use(express.staticCache());
app.use(express.static(path.join(__dirname, config.Config.rootDir)));

config.Config.app = app;

var model = require('./model_' + config.modelBackend);
model.start(config.Config);

var frontend = require('./frontend');
frontend.setModel(model);
frontend.start(config.Config);