const io = require('socket.io')(server, {
cors: {
origin: '*',
}
});
How can I change the syntax to TS? (import {} from '';
CodePudding user response:
You can't pass parameters to import in ES6 as you're doing with that require
.
However, the documentation suggest something like this:
import { createServer } from "http";
import { Server, Socket } from "socket.io";
const httpServer = createServer();
const io = new Server(httpServer, {
// ...
});