-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (20 loc) · 685 Bytes
/
server.js
File metadata and controls
28 lines (20 loc) · 685 Bytes
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
// Importing require modules
const express = require('express');
const app = express();
const cors = require('cors');
// For socket io server
const http = require('http');
const socketio = require('socket.io');
const manageChat = require('./manage-chat/socketio');
app.use(cors());
// Creating socket io server
const server = http.createServer(app);
// Creating socket io instance
const io = socketio(server);
// Managing socket io connection
manageChat(io);
// Defining routes
app.use('/api/rooms', require('./routes/api/rooms'));
// Defining port for listening
const PORT = process.env.PORT || 5000;
server.listen(PORT, () => console.log(`Server Started on PORT: ${PORT}`));