summaryrefslogtreecommitdiff
path: root/main.js
blob: 29f47c4999a68ee3ac45dbea67ee4155b1daadfc (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.createServer();

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

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