forked from Ajayos/CTS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (29 loc) · 969 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
/**
* Code by Ajay o s
* https://github.com/Ajayos
* https://github.com/Ajayos/Ajayos
*
*/
// connect to local files
const fs = require('fs');
const colors = require('colors');
const path_o = require('path');
const _path = path_o.resolve(__dirname, '.');
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const ip = require('ip');
require('dotenv').config();
/**
* Connecting to socket io
*/
const io = require('socket.io')(server,{ cors: { origin: 'http://' + ip.address() }}); require('./Router/socket.io/index.js')(io);
app.use((req, res, next) => {
req.io = io
next()
})
app.use('/', require('./Router/Home/index'));
app.use('/chat', require('./Router/chat/index'));
app.use('/voice', require('./Router/voice_/index'));
server.listen(process.env.PORT, console.log(`> Server started at:${process.env.PORT}`.green.bold + `\n> URL ${process.env.HOST}`.green.bold));