From 22ca5ca7de4e20228850f6b2d517134546279811 Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 30 Sep 2024 17:14:48 +0100 Subject: [PATCH] Add basic front-end, and socketIO connection --- public/index.html | 19 +++++++++++++++++++ public/main.js | 1 + public/style.css | 11 +++++++++++ server.js | 17 +++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 public/index.html create mode 100644 public/main.js create mode 100644 public/style.css create mode 100644 server.js diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..7dabda3 --- /dev/null +++ b/public/index.html @@ -0,0 +1,19 @@ + + + + + + + cardGame + + + + + + + + + + + + diff --git a/public/main.js b/public/main.js new file mode 100644 index 0000000..42be640 --- /dev/null +++ b/public/main.js @@ -0,0 +1 @@ +var socket = io(); diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..cbb32d0 --- /dev/null +++ b/public/style.css @@ -0,0 +1,11 @@ +html,body{ + margin: 0; + padding: 0; + background-color: #a1abaa; +} + +canvas{ + margin: auto; + display: block; +} + diff --git a/server.js b/server.js new file mode 100644 index 0000000..6dc6276 --- /dev/null +++ b/server.js @@ -0,0 +1,17 @@ +const express = require('express'); +const app = express(); +const http = require('http').Server(app); +const port = process.env.PORT || 3000; + +const io = require('socket.io')(http); + +app.use(express.static(__dirname + '/public')); + +io.on('connection', onConnection); + +http.listen(port, () => console.log('listening on port ' + port)); + +function onConnection(socket){ + console.log('a user connected'); +} +