-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (25 loc) · 934 Bytes
/
index.js
File metadata and controls
29 lines (25 loc) · 934 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
// Allows playing with the console output
const tracker = require('./src/utils/debug-logs');
// Load enviornmental variables defined in the .env file
const dotenvLoad = require('dotenv').config();
if (dotenvLoad.error) throw dotenvLoad.error;
const server = require('./src/server');
// const dbConnectionPromise = require('./src/models');
// Set if the API was run in debug mode
const isDebug = (process.env.DEBUG && process.env.DEBUG.toUpperCase() === 'TRUE') || false;
const main = async () => {
let serverInstance;
// let dbConnection;
try {
// dbConnection = await dbConnectionPromise;
serverInstance = server.start();
// Get console feedback of each API connection and request
if (isDebug) tracker(serverInstance);
} catch (error) {
console.error(error);
if (serverInstance) server.stop();
} finally {
// if (dbConnection && 'close' in dbConnection) dbConnection.close();
}
};
main();