Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 51 52 53 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const logger = require('../services/logger');
const config = require('./config');
/* TODO: removed for now due to environment change, possibly to be restored later
if (config.serviceDomain) {
let environment;
if (config.serviceDomain.startsWith('alpha')) environment = 'dev';
else if (config.serviceDomain.startsWith('beta')) environment = 'test';
else environment = 'prod';
logger.info(`APM configured to use ${environment} environment.`);
const apm = require('elastic-apm-node').start({
serviceName: `caleo-${environment}`,
serverUrl: 'http://10.4.11.76:8200'
});
} */
const path = require('path');
const loopback = require('loopback');
const boot = require('loopback-boot');
const app = loopback();
app.use(loopback.token());
app.use(
require('morgan')(':method :url :status :response-time ms :res[content-length]', {
stream: logger.stream
})
);
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.start = function() {
// start the web server
return app.listen(() => {
app.emit('started');
const baseUrl = app.get('url').replace(/\/$/, '');
logger.info(`Web server listening at: ${baseUrl}`);
if (app.get('loopback-component-explorer')) {
const explorerPath = app.get('loopback-component-explorer').mountPath;
logger.info(`Browse your REST API at ${baseUrl}${explorerPath}`);
}
});
};
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname, err => {
Iif (err) throw err;
// start the server if `$ node server.js`
Iif (require.main === module) app.start();
});
module.exports = app;
|