-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmdb-launch.mjs
38 lines (30 loc) · 1 KB
/
cmdb-launch.mjs
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
// Application Entry Point. This modules launchs the server with a set of configurations.
'use strict'
console.log("-------------- Start setting up server --------------")
import server from '#root/cmdb-server.mjs'
import configInit from '#root/cmdb-config.mjs'
import internal from '#data_access/internal/internal.mjs'
import elastic from '#data_access/elasticsearch/elasticsearch.mjs'
// Server configuration
const config = await configInit({
server: {
host: 'localhost',
port: 1904,
},
fetch: 'node', // local, node
database: internal // internal, elastic
})
// Launch server application
let app = server(config)
// Constants
const port = config.server.port
const host = config.server.host
// Sets the server to listen in the specified port and host
app.listen(port, host, (err) => {
if (err) {
console.log(err)
process.exit(1)
}
console.log(`Server is running on ${host}:${port}`)
})
console.log("--------------- End setting up server ---------------")