From 191996c3cccfde589af920815173d292499ff91b Mon Sep 17 00:00:00 2001 From: zhangtao25 Date: Mon, 16 Sep 2024 20:37:18 +0800 Subject: [PATCH] feat: update --- package.json | 4 ++-- packages/canyon-backend/package.json | 3 +-- packages/canyon-backend/src/main.ts | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 71da2cd8..d0e11518 100755 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dev": "pnpm -r do-dev", "build": "pnpm -r do-build", "rm": "node ./scripts/rm.js", - "migrate": "pnpm dlx prisma migrate dev --schema ./packages/canyon-backend/prisma/schema.prisma", + "migrate": "prisma migrate dev --schema ./packages/canyon-backend/prisma/schema.prisma", "preinstall": "node ./scripts/check.js", "prepare": "husky" }, @@ -21,4 +21,4 @@ "husky": "^9.1.6", "prisma": "5.16.1" } -} \ No newline at end of file +} diff --git a/packages/canyon-backend/package.json b/packages/canyon-backend/package.json index b33034c9..13326080 100755 --- a/packages/canyon-backend/package.json +++ b/packages/canyon-backend/package.json @@ -28,7 +28,6 @@ "canyon-data": "0.1.1-alpha.8", "class-transformer": "^0.5.1", "class-validator": "^0.14.1", - "cookie-parser": "^1.4.6", "dayjs": "^1.11.13", "diff": "^7.0.0", "dotenv": "^16.4.5", @@ -72,4 +71,4 @@ "tsconfig-paths": "^4.2.0", "typescript": "^5.6.2" } -} \ No newline at end of file +} diff --git a/packages/canyon-backend/src/main.ts b/packages/canyon-backend/src/main.ts index 36d7c065..9dc6a85c 100755 --- a/packages/canyon-backend/src/main.ts +++ b/packages/canyon-backend/src/main.ts @@ -1,16 +1,16 @@ import { NestFactory } from "@nestjs/core"; import { json } from "express"; import { ValidationPipe } from "@nestjs/common"; -import * as cookieParser from "cookie-parser"; import * as dotenv from "dotenv"; import * as path from "node:path"; + dotenv.config({ path: path.resolve(__dirname, "../../../.env"), }); + async function bootstrap() { const { AppModule } = await import("./app.module"); const app = await NestFactory.create(AppModule); - app.use(cookieParser()); app.useGlobalPipes(new ValidationPipe()); app.use( json({ @@ -18,6 +18,6 @@ async function bootstrap() { }), ); app.enableCors(); - await app.listen(8080); + await app.listen(process.env["PORT"] || 8080); } bootstrap();