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

How can I to get a io? #19

Open
HulioEglesias opened this issue Sep 25, 2019 · 1 comment
Open

How can I to get a io? #19

HulioEglesias opened this issue Sep 25, 2019 · 1 comment

Comments

@HulioEglesias
Copy link

HulioEglesias commented Sep 25, 2019

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 {}

@jockehewh
Copy link

when you export IO with the brackets you have to import it with the brackets like so:
const { io } = require('./socket')

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

No branches or pull requests

2 participants