diff --git a/packages/server/packages/play-node-go/server/bin/www b/packages/server/packages/play-node-go/server/bin/www index 51aceb3..9400248 100755 --- a/packages/server/packages/play-node-go/server/bin/www +++ b/packages/server/packages/play-node-go/server/bin/www @@ -90,5 +90,5 @@ function onListening() { } const socketIO = require('socket.io') -const socket = require('../socket').socket; -const io = socket(socketIO(server)); +const enableSocket = require('../socket').enableSocket; +const io = enableSocket(socketIO(server)); diff --git a/packages/server/packages/play-node-go/server/controllers/auth.js b/packages/server/packages/play-node-go/server/controllers/auth.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/server/packages/play-node-go/server/controllers/index.js b/packages/server/packages/play-node-go/server/controllers/index.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/server/packages/play-node-go/server/routes/api.js b/packages/server/packages/play-node-go/server/routes/api.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/server/packages/play-node-go/server/routes/auth.js b/packages/server/packages/play-node-go/server/routes/auth.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/server/packages/play-node-go/server/server.js b/packages/server/packages/play-node-go/server/server.js index 81fc4da..0230293 100644 --- a/packages/server/packages/play-node-go/server/server.js +++ b/packages/server/packages/play-node-go/server/server.js @@ -2,8 +2,6 @@ const createError = require('http-errors'); const express = require('express'); const cors = require('cors'); -const socketIO = require("socket.io"); -const http = require('http'); const path = require('path'); const cookieParser = require('cookie-parser'); @@ -18,14 +16,10 @@ const indexRouter = require('./routes/index'); const usersRouter = require('./routes/users'); const app = express(); -const server = require('./bin/www'); - const corsOptions = { origin: process.env.REACT_ADDRESS } -const port = process.env.PORT; - app.options('*', cors(corsOptions)); app.use('*', cors(corsOptions)); diff --git a/packages/server/packages/play-node-go/server/socket.js b/packages/server/packages/play-node-go/server/socket.js index 0ad49fc..e3aeefb 100644 --- a/packages/server/packages/play-node-go/server/socket.js +++ b/packages/server/packages/play-node-go/server/socket.js @@ -1,10 +1,14 @@ +// TODO const someSocketLogic = require('./middleware/socketssockets/...'); + module.exports = { - socket: io => { + enableSocket: io => { io.on('connection', () => console.log('connected')) io.on('connect', ()=> { - console.log('connected'); - io.emit('connected', {message: 'socket connected'}); + io.emit('connected', {message: 'socket connected'}); }) + + // TODO io = someSocketLogic(io); + return io; } } \ No newline at end of file