Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cors enabled for chat server #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

alishx31
Copy link

@alishx31 alishx31 commented Mar 9, 2021

cors enabled in nodejs chat server before server initialized

@@ -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

Comment on lines -9 to +22
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'));
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants