-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·31 lines (26 loc) · 966 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
const constants = require("./src/utils/constants");
const application = constants.APPLICATION
const env = constants.DEFAULT_ENV
// adding environment variables to process
require("dotenv").config(
{
path: `${__dirname}/config/${application}/${env}/application.env`
});
const App = require("./src/application/app");
const { initDatabases } = require("./src/dbaccessor");
const { logger } = require("./src/logging/logger");
const startApplication = async () => {
try {
logger.info("initializing application");
await initDatabases();
const app = new App();
app.start();
} catch (appError) {
const { message: error, stack } = appError;
const message = `unable to init application : ${error}\n${stack}`;
console.error(message);
logger.error(message);
process.exit(2);
}
};
startApplication().then(() => logger.info("........Application Started Successfully......"));