I have following code in node.js.
const express = require("express");
var socket = require("socket.io");
class Server {
constructor() {
this.app = express();
this.port = process.env.PORT || 89;
this.host = process.env.HOST || `192.168.43.173:89`;
}
includeRoutes() {
}
appExecute() {
var server = this.app.listen(this.port, () => {
console.log(`Listening on http://${this.host}`);
});
var io = socket(server);
}
}
const server = new Server();
server.appExecute();
below are the dependencies exist in package.json file.
"express": "^4.17.1",
"socket.io": "^2.3.0"
I am facing an issue when the line is executed var io = socket(server);
Error Details.
Unexpected Token ...options.
Here is the screenshot.
Can you please suggest something? If you need more info, please let me know
