-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
71 lines (55 loc) · 1.71 KB
/
app.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'use strict';
// Prevent inevitable timezone confusion between servers, UIs, and APIs
process.env.TZ = 'UTC';
// Get the environment name from the ENVIRONMENT_NAME environment variable if
// it has been set, otherwise use 'local'
var environmentName = process.env.ENVIRONMENT_NAME || 'local';
// Load in our app class
var ThingsTodoApp = require('./src/thingsTodo');
// Create an instance of our app
var thingsTodoApp = new ThingsTodoApp({
env: environmentName,
baseDir: __dirname,
srcDir: './src',
etcDir: './etc',
/**
* Additional dependencies to make available
*/
provide: {
/**
* Creates an injectable instance of the XublitMongoDb module, which
* will be bootstrapped with the configuration options specified
* the configuration specified, dependency with the reference '$mongoDb'
*/
$mongoDb: {
usingConfiguration: 'mongodb',
createInstanceOf: 'XublitMongoDb',
},
$restServer: {
usingConfiguration: 'restServer',
createInstanceOf: 'XublitRestServer',
},
},
});
// MongoDB
thingsTodoApp.provide('$mongoDb', {
usingConfiguration: 'mongodb',
createInstanceOf: 'XublitMongoDb',
});
// REST Server
thingsTodoApp.provide('$restServer', {
usingConfiguration: 'restServer',
createInstanceOf: 'XublitRestServer',
});
// Relational Models
thingsTodoApp.provide('$models', {
usingConfiguration: 'models',
createInstanceOf: 'XublitRelationalModels',
});
// Start it up!
// Bootstrap modules, emit startup events, etc.
thingsTodoApp.start();
// Log any uncaught errors in console
process.on('uncaughtException', function (err) {
console.log(err);
});