-
Notifications
You must be signed in to change notification settings - Fork 55
/
index.js
39 lines (33 loc) · 841 Bytes
/
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
import { initHapiServer } from './server';
const path = require('path');
const nconf = require('nconf');
const logger = require('./server/lib/logger');
// Initialize babel.
require('@babel/register')({
ignore: [ /node_modules/ ],
sourceMaps: !(process.env.NODE_ENV === 'production')
});
require('@babel/polyfill');
// Initialize configuration.
nconf
.argv()
.env()
.file(path.join(__dirname, './server/config.json'))
.defaults({
AUTH0_RTA: 'auth0.auth0.com',
DATA_CACHE_MAX_AGE: 1000 * 10,
NODE_ENV: 'development',
HOSTING_ENV: 'default',
PORT: 3001,
USE_OAUTH2: false,
LOG_COLOR: true
});
// Start the server.
initHapiServer.then((err, server) => {
if (err) {
return logger.error(err);
}
return server.start(() => {
logger.info('Server running at:', server.info.uri);
});
});