forked from auth0-extensions/auth0-deploy-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (31 loc) · 823 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
const path = require('path');
const nconf = require('nconf');
const logger = require('./server/lib/logger');
// Initialize babel.
require('babel-core/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: 'https://auth0.auth0.com',
NODE_ENV: 'development',
HOSTING_ENV: 'default',
PORT: 3001,
WT_URL: 'http://localhost:3000'
});
// Start the server.
const app = require('./server')((key) => nconf.get(key), null);
const port = nconf.get('PORT');
app.listen(port, (error) => {
if (error) {
logger.error(error);
} else {
logger.info(`Listening on http://localhost:${port}.`);
}
});