Reputation: 77
My io is undefined, what are possible reasons for this?
arduino.js
var debug = require('debug')('arduino');
var five = require('johnny-five');
var socket = io();
index.js
var debug = require('debug')('server');
var express = require('express');
var http = require('http');
var socketIo = require('socket.io');
var app = express();
var httpServer = http.createServer(app);
var io = socketIo(httpServer);
what could be the issue?
Upvotes: 0
Views: 401
Reputation: 944521
io
is a local variable in the index.js
module.
arduino.js
is a different module.
It doesn't appear to use index.js
, nor does index.js
appear to use it. Even if that was the case, io
is a local variable that isn't exported so is not available outside the module it is defined in.
Upvotes: 3