Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ const express = require('express');
const http = require('http');
const socketio = require('socket.io');
const socketEvents = require('./utils/socket');
let cors = require('cors');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use const here


class Server {
constructor() {
this.port = process.env.PORT || 3000;
constructor() {
this.port = process.env.PORT || 3000;
this.host = process.env.HOST || `localhost`;

this.app = express();
this.app.use(cors());
this.http = http.Server(this.app);
this.socket = socketio(this.http);
}
}

appRun(){
new socketEvents(this.socket).socketConfig();
this.app.use(express.static(__dirname + '/uploads'));
appRun() {
new socketEvents(this.socket).socketConfig();
this.app.use(express.static(__dirname + '/uploads'));
Comment on lines -9 to +22
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep 4 space indent

this.http.listen(this.port, this.host, () => {
console.log(`Listening on http://${this.host}:${this.port}`);
});
Expand Down
42 changes: 35 additions & 7 deletions nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"license": "ISC",
"dependencies": {
"config": "^1.30.0",
"cors": "^2.8.5",
"express": "^4.16.3",
"moment": "^2.22.2",
"mysql": "^2.15.0",
Expand Down