-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-main.ts
More file actions
51 lines (33 loc) · 1.03 KB
/
app-main.ts
File metadata and controls
51 lines (33 loc) · 1.03 KB
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
41
42
43
44
45
46
47
48
"use strict";
let apps = require('./index');
const config = require('./config/config.dev');
let port = process.env.PORT || 8090;
import {connectDB} from "./db/typeorm-connect";
const startServer = async () => {
var app = apps.listen(port, () => {
console.log(`Application is running on port ${port}`);
const io = require('./src/io/io').init(app);
io.on('connection', (socket: any) => {
console.log('Client Connected');
io.emit('posts', {message: 'I am connected'});
});
io.on('connect_failed', function() {
console.log("Sorry, there seems to be an issue with the connection!");
})
});
};
(async () => {
await connectDB();
await startServer();
})();
// const io = require('./src/io/io').init(apps);
//
// io.on('connection', (socket: any) => {
// console.log('Io Client Connected');
// });
//
// io.emit('posts', {message: 'I am connected'});
//
// io.connect(apps, null).then(() => {
// console.log(`IO is connected`);
// });