impl simple backend
Some checks failed
Deploy Backend / deploy (push) Failing after 29s

This commit is contained in:
Lee 2024-10-04 22:21:37 +01:00
parent cd7cc29afd
commit e105a76bf2
18 changed files with 2347 additions and 28 deletions

25
backend/.eslintrc.js Normal file

@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};

8
backend/nest-cli.json Normal file

@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
}
}

@ -4,16 +4,39 @@
"author": "fascinated7", "author": "fascinated7",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"main": "src/index.ts",
"scripts": { "scripts": {
"dev": "concurrently -k \"tsup --watch\" \"nodemon dist/index.js\"", "dev": "nest start --watch --webpack webpack-hmr.config.js",
"build": "tsup", "build": "nest build",
"start": "node dist/index.js" "start": "nest start"
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
}, },
"devDependencies": { "devDependencies": {
"@ssr/common": "workspace:*",
"concurrently": "^9.0.1", "concurrently": "^9.0.1",
"nodemon": "^2.0.20", "nodemon": "^2.0.20",
"tsup": "^8.3.0", "tsup": "^8.3.0",
"typescript": "^5" "typescript": "^5",
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@types/express": "^4.17.17",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"prettier": "^3.0.0",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1"
} }
} }

10
backend/src/app.module.ts Normal file

@ -0,0 +1,10 @@
import { Module } from "@nestjs/common";
import { AppController } from "./controller/app.controller";
import { AppService } from "./service/app.service";
@Module({
imports: [],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}

@ -0,0 +1,12 @@
import { Controller, Get } from "@nestjs/common";
import { AppService } from "../service/app.service";
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
return this.appService.getHello();
}
}

@ -1 +0,0 @@
console.log("meow!!!");

8
backend/src/main.ts Normal file

@ -0,0 +1,8 @@
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(8080);
}
bootstrap();

@ -0,0 +1,9 @@
import { Injectable } from "@nestjs/common";
import { helloMeowMeow } from "@ssr/common/dist";
@Injectable()
export class AppService {
getHello(): string {
return helloMeowMeow();
}
}

@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}

@ -1,12 +1,21 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022",
"module": "commonjs", "module": "commonjs",
"esModuleInterop": true, "declaration": true,
"forceConsistentCasingInFileNames": true, "removeComments": true,
"strict": true, "emitDecoratorMetadata": true,
"skipLibCheck": true "experimentalDecorators": true,
}, "allowSyntheticDefaultImports": true,
"include": ["src"], "target": "ES2021",
"exclude": ["node_modules"] "sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
}
} }

@ -0,0 +1,6 @@
module.exports = function (options) {
return {
...options,
stats: "minimal", // This disables the full-screen mode and simplifies the output
};
};

16
common/package.json Normal file

@ -0,0 +1,16 @@
{
"name": "@ssr/common",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "tsup src/index.ts --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"tsup": "^6.5.0",
"typescript": "^5"
}
}

3
common/src/index.ts Normal file

@ -0,0 +1,3 @@
export function helloMeowMeow() {
return "hi";
}

21
common/tsconfig.json Normal file

@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2021",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
}
}

@ -2,9 +2,7 @@ import { defineConfig } from "tsup";
export default defineConfig({ export default defineConfig({
entry: ["src/index.ts"], entry: ["src/index.ts"],
format: ["esm", "cjs"],
splitting: false, splitting: false,
dts: true, sourcemap: true,
clean: true, clean: true,
outDir: "./dist",
}); });

@ -2,9 +2,7 @@
"name": "scoresaber-reloadedv3", "name": "scoresaber-reloadedv3",
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"dev": "pnpm run -r dev", "dev": "pnpm --parallel --workspace-concurrency=4 run -r dev",
"dev:backend": "pnpm --filter backend dev",
"dev:website": "pnpm --filter website dev",
"build:website": "pnpm --filter website build", "build:website": "pnpm --filter website build",
"build:backend": "pnpm --filter backend build", "build:backend": "pnpm --filter backend build",

2183
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

@ -1,3 +1,4 @@
packages: packages:
- "website" - "website"
- "backend" - "backend"
- "common"