From e161df40f35f47771ae642f99935c994d32179b9 Mon Sep 17 00:00:00 2001 From: twoo1999 Date: Fri, 24 Nov 2023 10:49:07 +0900 Subject: [PATCH] =?UTF-8?q?[BE]=20=E2=9C=A8=20:=20=EB=B0=B0=ED=8F=AC?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=A0=9C=EC=9E=91=20(#109)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * swagger 설정 * :memo: Express 추가 express 추가해서 html 파일 전송하는 기능 추가 * :sparkles: 배포를 위한 페이지 구현 배포 시 사용하는 페이지를 만듬 --- BE/musicspot/package-lock.json | 57 +++++++++++++++++-- BE/musicspot/package.json | 3 +- BE/musicspot/public/release.html | 15 +++++ BE/musicspot/src/app.module.ts | 4 +- BE/musicspot/src/main.ts | 3 +- .../src/releasePage/release.controller.ts | 13 +++++ 6 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 BE/musicspot/public/release.html create mode 100644 BE/musicspot/src/releasePage/release.controller.ts diff --git a/BE/musicspot/package-lock.json b/BE/musicspot/package-lock.json index 087fe7e..42f980b 100644 --- a/BE/musicspot/package-lock.json +++ b/BE/musicspot/package-lock.json @@ -12,7 +12,7 @@ "@nestjs/common": "^10.0.0", "@nestjs/core": "^10.0.0", "@nestjs/mongoose": "^10.0.2", - "@nestjs/platform-express": "^10.0.0", + "@nestjs/platform-express": "^10.2.10", "@nestjs/swagger": "^7.1.15", "@types/dotenv": "^8.2.0", "@types/multer": "^1.4.10", @@ -21,6 +21,7 @@ "class-validator": "^0.14.0", "dotenv": "^16.3.1", "gitmoji-cli": "^9.0.0", + "handlebars": "^4.7.8", "mongoose": "^8.0.0", "reflect-metadata": "^0.1.13", "rxjs": "^7.8.1", @@ -1707,9 +1708,9 @@ } }, "node_modules/@nestjs/platform-express": { - "version": "10.2.8", - "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-10.2.8.tgz", - "integrity": "sha512-WoSSVtwIRc5AdGMHWVzWZK4JZLT0f4o2xW8P9gQvcX+omL8W1kXCfY8GQYXNBG84XmBNYH8r0FtC8oMe/lH5NQ==", + "version": "10.2.10", + "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-10.2.10.tgz", + "integrity": "sha512-U4KDgtMjH8TqEvt0RzC/POP8ABvL9bYoCScvlGtFSKgVGaMLBKkZ4+jHtbQx6qItYSlBBRUuz/dveMZCObfrkQ==", "dependencies": { "body-parser": "1.20.2", "cors": "2.8.5", @@ -6225,6 +6226,34 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8117,8 +8146,7 @@ "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, "node_modules/netmask": { "version": "2.0.2", @@ -10421,6 +10449,18 @@ "node": ">=14.17" } }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/uid": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", @@ -10923,6 +10963,11 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" + }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", diff --git a/BE/musicspot/package.json b/BE/musicspot/package.json index 0e950ee..ede3717 100644 --- a/BE/musicspot/package.json +++ b/BE/musicspot/package.json @@ -23,7 +23,7 @@ "@nestjs/common": "^10.0.0", "@nestjs/core": "^10.0.0", "@nestjs/mongoose": "^10.0.2", - "@nestjs/platform-express": "^10.0.0", + "@nestjs/platform-express": "^10.2.10", "@nestjs/swagger": "^7.1.15", "@types/dotenv": "^8.2.0", "@types/multer": "^1.4.10", @@ -32,6 +32,7 @@ "class-validator": "^0.14.0", "dotenv": "^16.3.1", "gitmoji-cli": "^9.0.0", + "handlebars": "^4.7.8", "mongoose": "^8.0.0", "reflect-metadata": "^0.1.13", "rxjs": "^7.8.1", diff --git a/BE/musicspot/public/release.html b/BE/musicspot/public/release.html new file mode 100644 index 0000000..4400008 --- /dev/null +++ b/BE/musicspot/public/release.html @@ -0,0 +1,15 @@ + + + + + + 배포 페이지 + + + 0.0 + - 배포 2023.11.24 + + diff --git a/BE/musicspot/src/app.module.ts b/BE/musicspot/src/app.module.ts index b47923c..efd06f9 100644 --- a/BE/musicspot/src/app.module.ts +++ b/BE/musicspot/src/app.module.ts @@ -6,6 +6,8 @@ import { JourneyModule } from './journey/module/journey.module'; import { SpotModule } from './spot/module/spot.module'; import { UserModule } from './user/module/user.module'; import * as dotenv from 'dotenv'; + +import { ReleaseController } from './releasePage/release.controller'; dotenv.config(); @Module({ @@ -17,7 +19,7 @@ dotenv.config(); UserModule, SpotModule, ], - controllers: [AppController], + controllers: [AppController, ReleaseController], providers: [AppService], }) export class AppModule {} diff --git a/BE/musicspot/src/main.ts b/BE/musicspot/src/main.ts index 4731111..eab98e7 100644 --- a/BE/musicspot/src/main.ts +++ b/BE/musicspot/src/main.ts @@ -2,8 +2,9 @@ import { NestFactory } from '@nestjs/core'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; import { AppModule } from './app.module'; import { ValidationPipe } from '@nestjs/common'; +import { NestExpressApplication } from '@nestjs/platform-express'; async function bootstrap() { - const app = await NestFactory.create(AppModule); + const app = await NestFactory.create(AppModule); const config = new DocumentBuilder() .setTitle('Music Spot') // 문서의 제목 .setDescription('iOS01 Music Spot App API') // 문서의 간단한 설명 diff --git a/BE/musicspot/src/releasePage/release.controller.ts b/BE/musicspot/src/releasePage/release.controller.ts new file mode 100644 index 0000000..f9b8c44 --- /dev/null +++ b/BE/musicspot/src/releasePage/release.controller.ts @@ -0,0 +1,13 @@ +import { Controller, Get, Render, Res } from '@nestjs/common'; +import { Response } from 'express'; +import * as fs from 'fs'; +import { join } from 'path'; +@Controller('release') +export class ReleaseController { + @Get() + sendReleasePage(@Res() res: Response) { + res + .status(200) + .sendFile(join(__dirname, '..', '..', 'public', 'release.html')); + } +}