-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlyfecycle-api.js
More file actions
35 lines (29 loc) · 838 Bytes
/
lyfecycle-api.js
File metadata and controls
35 lines (29 loc) · 838 Bytes
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
var async = require('async');
// setup
var context = {};
context.settings = require('./settings');
async.series([setupDatabases, setupApp, listen], ready); // do these things in order!
function setupDatabases(callback) {
context.directionsHelper = require('./directions-helper');
context.directionsHelper.init(context, callback);
context.locationDb = require('./location-database');
context.locationDb.init(context, callback);
context.userDb = require('./user-database');
context.userDb.init(context, callback);
}
function setupApp(callback) {
context.app = require('./app');
context.app.init(context, callback);
}
function listen(callback) {
context.app.listen(context.settings.portNum);
callback(null); // don't do anything
}
function ready(err)
{
if (err)
{
throw err;
}
console.log('All ready!');
}