Open HulioEglesias opened 5 years ago
I want to get created io from other file. socket.js
const IO = require( 'koa-socket-2' ); const io = new IO(); module.exports = { io }
File where I want to get access to io:
const io = require('./socket').io;
But io is undefined, and require('./socket') is {}
require('./socket')
{}
when you export IO with the brackets you have to import it with the brackets like so: const { io } = require('./socket')
const { io } = require('./socket')
I want to get created io from other file. socket.js
File where I want to get access to io:
But io is undefined, and
require('./socket')
is{}