-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (24 loc) · 921 Bytes
/
index.js
File metadata and controls
31 lines (24 loc) · 921 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
const config = require('./config');
const routes = require('./routes');
const express = require('express');
const bodyParser = require('body-parser');
function startApp() {
const app = express();
app.disable('x-powered-by');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
const hbs = config.views.engine;
hbs.registerPartials(config.views.partialsPath);
app.engine('html', hbs.__express); // eslint-disable-line no-underscore-dangle
app.set('view engine', 'html');
routes(app);
if (config.appNetwork === 'private' && !config.appNetworkInterface) {
console.log('Couldn\'t determine private interface - restricting to localhost');
config.appNetworkInterface = '127.0.0.1';
}
// start app
app.listen(config.appPort, config.appNetworkInterface, 0, () => {
console.log('Media Extractor API listening on port', config.appPort);
});
}
startApp();