forked from arne/TanksJS-Server
First Commit
This commit is contained in:
commit
0439c5ff6c
34
.eslintrc.js
Normal file
34
.eslintrc.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"commonjs": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"double"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
._*
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
release
|
2
README.md
Normal file
2
README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# TanksJS-server
|
||||||
|
Node-JS server for multiplayer interactions in the game TanksJS.
|
4
css/index.css
Normal file
4
css/index.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
body {
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
}
|
12
html/index.html
Normal file
12
html/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>TanksJS-Server</title>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>TanksJS-Server</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
2616
package-lock.json
generated
Normal file
2616
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
38
package.json
Normal file
38
package.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"name": "tanksjs-server",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Node-JS server for multiplayer interactions in the game TanksJS.",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "npm run lint && nodemon ./src/index.js",
|
||||||
|
"lint": "eslint ."
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitea.arnweb.nl/arne/TanksJS-Server"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"tanksjs",
|
||||||
|
"asdf",
|
||||||
|
"game",
|
||||||
|
"multiplayer",
|
||||||
|
"js",
|
||||||
|
"server",
|
||||||
|
"express",
|
||||||
|
"socket.io"
|
||||||
|
],
|
||||||
|
"author": {
|
||||||
|
"name": "Arne van Iterson",
|
||||||
|
"email": "arne@arnweb.nl",
|
||||||
|
"url": "https://arnweb.nl"
|
||||||
|
},
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"socket.io": "^2.3.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^6.8.0",
|
||||||
|
"nodemon": "^2.0.3"
|
||||||
|
}
|
||||||
|
}
|
23
src/index.js
Normal file
23
src/index.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
var app = require("express")();
|
||||||
|
var http = require("http").createServer(app);
|
||||||
|
var io = require("socket.io")(http);
|
||||||
|
|
||||||
|
var path = require("path");
|
||||||
|
|
||||||
|
// Send html & css files
|
||||||
|
app.get("/", (req, res) => {
|
||||||
|
res.sendFile(path.join(__dirname + "/../html/index.html"));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/index.css", (req, res) => {
|
||||||
|
res.sendFile(path.join(__dirname + "/../css/index.css"));
|
||||||
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
io.on("connection", (socket) => {
|
||||||
|
console.log("A user connected");
|
||||||
|
});
|
||||||
|
|
||||||
|
http.listen(3000, () => {
|
||||||
|
console.log("listening on *:3000");
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user