-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
50 lines (43 loc) · 1.29 KB
/
index.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
if (!global.AA) { global.AA = {}; }
//GET ENVIORMENT
var environment = 'dev';
if (process.argv['env']) {
switch (process.argv['env'].toLowerCase()) {
case 'stage':
environment = 'stage';
break;
case 'prod':
environment = 'prod';
break;
default:
environment = 'dev';
break;
}
}
//Modules
AA.async = require('async');
AA.lodash = require('lodash');
AA.Hapi = require("hapi");
AA.Joi = require("joi");
AA.Mongo = require('mongoose');
AA.neo4j = require('neo4j');
//Settings
AA.Settings = require('./settings')({env: environment});
//Data Sets
AA.MongoDB = AA.Mongo.connect(AA.Settings.MONGODB.URL);
AA.NEO4JGraph = new AA.neo4j.GraphDatabase(AA.Settings.NEO4J.URL);
// AA.NEO4J.getNode
AA.Validation = require('./adapters/validate');
AA.Routes = require('./routes');
AA.Schema = require('./schemas');
AA.Models = require('./models');
AA.Controllers = require('./controllers');
AA.server = new AA.Hapi.Server(AA.Settings.PORT, AA.Settings.HOST);
AA.server.route([
AA.Routes.external.follow.routes.follow,
AA.Routes.external.follow.routes.unfollow,
AA.Routes.external.follow.routes.check_relationship
]);
AA.server.start(function() {
console.log("Hapi server started @", AA.server.info.uri);
});