forked from Sxip/critters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
40 lines (33 loc) · 1010 Bytes
/
index.ts
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
import { RoomService } from '@/api/services/RoomService'
import { PluginManager } from '@/core/PluginManager'
import { config as dotEnvConfig } from 'dotenv'
import 'reflect-metadata'
import Container from 'typedi'
import { Server } from './src/index'
/**
* Dotenv config
*/
dotEnvConfig();
/**
* Initializes the application.
*
* @method
*/
(async () => {
try {
const server = await Server.bootstrap()
.ioc()
.ignite()
// Loads the rooms
await Container.get(RoomService).load()
// Loads all of the plugins
await PluginManager.loadAll()
console.log('----------------------------------------')
console.info(`Environment: ${server.app.get('env')}`)
console.info(`Base URL: http://localhost:${server.app.get('port')}`)
console.info(`WebSocket: http://localhost:${server.app.get('ws')}/socket.io`)
console.log('----------------------------------------')
} catch (error) {
console.error(`Initializing failed! Reason: ${error.stack}`)
}
})()