Add basic front-end, and socketIO connection
parent
834e06ff5a
commit
22ca5ca7de
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<title>cardGame</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<canvas id="canvas" width="1000" height="600"></canvas>
|
||||
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/main.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
var socket = io();
|
||||
@ -0,0 +1,11 @@
|
||||
html,body{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #a1abaa;
|
||||
}
|
||||
|
||||
canvas{
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue