Separated frontend and backend, created basic dev environment and websocket server

This commit is contained in:
Dmitriy Shishkov 2021-09-04 15:08:12 +03:00
parent df2873dc48
commit 7fff6d4006
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
19 changed files with 58 additions and 0 deletions

6
back/nodemon.json Normal file
View File

@ -0,0 +1,6 @@
{
"watch": ["src/"],
"ext": "ts,json",
"exec": "etsc && node ./dist/index.js",
"legacyWatch": true
}

26
back/package.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "roomruler",
"version": "1.0.0",
"description": "Web application for distribution of free classrooms",
"scripts": {
"build": "esbuild src/index.ts --bundle --minify --outdir=dist --platform=node",
"start": "esbuild",
"dev": "nodemon"
},
"author": "dm1sh",
"license": "MIT",
"devDependencies": {
"@types/ws": "^7.4.7",
"esbuild": "^0.12.25",
"esbuild-envfile-plugin": "^1.0.1",
"esbuild-node-tsc": "^1.6.1",
"nodemon": "^2.0.12",
"typescript": "^4.4.2"
},
"dependencies": {
"pg": "^8.7.1",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.37",
"ws": "^8.2.1"
}
}

12
back/src/index.ts Normal file
View File

@ -0,0 +1,12 @@
import "reflect-metadata";
import { Server } from "ws";
(async () => {
const wss = new Server({
port: Number.parseInt(process.env.PORT || "") || 8081,
});
wss.on("connection", async (ws) => {
ws.send("hello");
});
})();

14
back/tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"esModuleInterop": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": false,
"skipLibCheck": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "dist"
}
}