stub middleware (including socket), controllers architecture
This commit is contained in:
parent
64dc036296
commit
34dbdaab7b
7 changed files with 9 additions and 11 deletions
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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'});
|
||||
})
|
||||
|
||||
// TODO io = someSocketLogic(io);
|
||||
|
||||
return io;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue