-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (23 loc) · 740 Bytes
/
index.js
File metadata and controls
25 lines (23 loc) · 740 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
'use strict';
const express = require('express');
const http = require('http');
const socketio = require('socket.io');
const socketEvents = require('./utils/socket');
class Server{
constructor(){
this.port = process.env.PORT || 3000;
this.host = process.env.HOST || 'localhost';
this.app = express();
this.http = http.Server(this.app);
this.socket = socketio(this.http);
}
appRun(){
new socketEvents(this.socket).socketConfig();
this.app.use(express.static(__dirname + '/uploads'));
this.http.listen(this.port, this.host, ()=>{
console.log(`Listening on http://${this.host}:${this.port}`);
});
}
}
const app = new Server();
app.appRun();