diff --git a/api/socket.io.js b/api/socket.io.js deleted file mode 100644 index 96da8fb..0000000 --- a/api/socket.io.js +++ /dev/null @@ -1,29 +0,0 @@ -import { Server as SocketServer } from 'socket.io'; - -const ioHandler = (req, res) => { - if (!res.socket.server.io) { - console.log('*First use, starting socket.io'); - const io = new SocketServer(res.socket.server, { - path: '/api/socketio', - addTrailingSlash: false, - }); - - io.on('connection', (socket) => { - console.log('A user connected'); - // Your socket event handlers - }); - - res.socket.server.io = io; - } else { - console.log('socket.io already running'); - } - res.end(); -} - -export const config = { - api: { - bodyParser: false - } -}; - -export default ioHandler; \ No newline at end of file diff --git a/api/socketio.js b/api/socketio.js new file mode 100644 index 0000000..0782362 --- /dev/null +++ b/api/socketio.js @@ -0,0 +1,28 @@ +import { Server } from "socket.io"; +import { setupSocketHandlers } from "../src/utils/socketHandlers"; + +const ioHandler = (req, res) => { + if (!res.socket.server.io) { + console.log("*First use, starting socket.io"); + + const io = new Server(res.socket.server, { + path: "/api/socketio", + addTrailingSlash: false, + }); + + setupSocketHandlers(io); + + res.socket.server.io = io; + } else { + console.log("socket.io already running"); + } + res.end(); +}; + +export const config = { + api: { + bodyParser: false, + }, +}; + +export default ioHandler; \ No newline at end of file diff --git a/public/admin.html b/public/admin.html index 2b253a2..ee19d65 100644 --- a/public/admin.html +++ b/public/admin.html @@ -3,52 +3,49 @@ - Admin Dashboard - Multiplayer Drawing Game + Admin Dashboard - - -

Admin Dashboard

- - - +

Waiting Players

- +

Game Control

- +
- + - + - + View Leaderboard - + +
+
- +
- + diff --git a/public/css/styles.css b/public/css/styles.css index 202f08d..0a636a6 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -21,6 +21,7 @@ body { box-shadow: 0 0 10px rgba(0,0,0,0.1); width: 100%; max-width: 500px; + align-self: flex-start; } h1 { diff --git a/public/index.html b/public/index.html index e7d520d..5b13db8 100644 --- a/public/index.html +++ b/public/index.html @@ -2,26 +2,25 @@ - - Multiplayer Drawing Game + + AI MongoDB / AWS Drawing Game - - - -

AI MongoDB / AWS Drawing Game

- + +
+ +
+