Converted game server to typescript

This commit is contained in:
Thomas Cole 2023-03-13 18:37:47 -04:00
parent 35f470d6e2
commit 375b87ce0f
5 changed files with 822 additions and 190 deletions

14
apps/server/.eslintrc.js Normal file
View File

@ -0,0 +1,14 @@
module.exports = {
env: {
es2021: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 13,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {},
}

View File

@ -3,14 +3,22 @@
"version": "0.0.1",
"description": "",
"scripts": {
"dev": "nodemon server.js",
"start": "node server.js"
"dev": "nodemon src/server.ts",
"start": "tsc && node dist/server.js"
},
"dependencies": {
"express":"^4.18.2",
"socket.io":"^4.6.1"
},
"devDependencies": {
"nodemon":"^2.0.21"
"nodemon":"^2.0.21",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"eslint": "^8.28.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.5.1",
"eslint-plugin-promise": "^6.1.1",
"typescript": "^4.9.3",
"ts-node":"^10.9.1"
}
}

View File

@ -9,11 +9,11 @@ const io = new Server(server, {
}
});
app.get('/', (req, res) => {
app.get('/', (req: any, res: any) => {
res.send('<h1>Quippy Server</h1>');
});
io.on('connection', (socket) => {
io.on('connection', (socket: any) => {
console.log("SocketIO connected to a user.")
})

12
apps/server/tsconfig.json Normal file
View File

@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"strict": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist"
},
"lib": ["es2015"]
}

968
package-lock.json generated

File diff suppressed because it is too large Load Diff