var express = require('express')
, app = express()
, path = require('path')
, server = require('http').createServer(app)
, io = require('socket.io')(server)
, mod = require("./mod")
mod.run();
server.listen(8080);
app.use(express.static(path.join(__dirname, 'public'));
mod = {
run:()=> {
//Как тут использовать io?
}
}
module.exports = mod;
module.exports = class Mod {
constructor({ io }) {
this.io = io;
}
run() {
this.io.something();
}
}
var express = require('express')
, app = express()
, path = require('path')
, server = require('http').createServer(app)
, io = require('socket.io')(server)
, Mod = require("./mod")
const mod = new Mod({ io });
mod.run();
server.listen(8080);
app.use(express.static(path.join(__dirname, 'public'));