-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (30 loc) · 952 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
36
37
38
39
import express from 'express';
import Table from 'ascii-table';
const table = new Table('App Configuration');
import {
env,
resourceConfig,
routesConfig,
passportConfig,
connect
} from "./src/config/index.js";
const {PORT} = env;
// init express instance
const app = express();
// passport config
const passwordConfigStatus = passportConfig(app);
// config resources
const resourceConfigStatus = resourceConfig(app);
// config routes
routesConfig(app);
// connect to database
const dbConnectStatus = await connect();
const COLUMNS_NAME = ['Status', 'Message'];
table.setHeading(...COLUMNS_NAME);
table.addRow(passwordConfigStatus.status, passwordConfigStatus.message);
table.addRow(resourceConfigStatus.status, resourceConfigStatus.message);
table.addRow(dbConnectStatus.status, dbConnectStatus.message);
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}.`);
console.log(table.toString());
});