백엔드
백엔드는 Nest.js 기반으로 구현되어있습니다.
환경설정
환경설정은 각 환경에 맞게 변수를 설정해야할 경우 사용합니다.
백엔드의 환경설정 파일은 아래의 디렉토리에 있습니다.
backend/configuration
3개의 환경설정 파일이 존재합니다.
backend/configuration/local.yaml
backend/configuration/development.yaml
backend/configuration/production.yaml
http:
port: 9001
db:
host: 'localhost'
port: 4001
username: 'docker'
password: 'docker'
database: 'develop'
session:
secretKey: 'b3aa9ad4-c8e9-4715-9c3f-75d91fe86471'
http.port는 백엔드의 기동 포트입니다. db.host는 데이터베이스 호스트입니다. db.port는 데이터베이스의 포트입니다. db.username은 데이터베이스의 계정입니다. db.password는 데이터베이스의 비밀번호입니다. db.database는 데이터베이스의 데이터베이스입니다. db.session.secretKey는 세션 암호화 시 사용되는 비밀키입니다.
서버기동
yarn start:local
local.yaml을 읽어서 MacOS/Linux환경에서 서버를 기동합니다.
yarn start:dev
development.yaml을 읽어서 MacOS/Linux환경에서 서버를 기동합니다.
yarn start:prod
production.yaml을 읽어서 MacOS/Linux환경에서 서버를 기동합니다.
yarn start:local_win
local.yaml을 읽어서 Windows환경에서 서버를 기동합니다.
yarn start:dev_win
development.yaml을 읽어서 Windows환경에서 서버를 기동합니다.
yarn start:prod_win
production.yaml을 읽어서 Windows환경에서 서버를 기동합니다.
디버깅
VSCode 에디터를 사용하여 디버깅할 수 있습니다.
프로젝트 내에 .vscode/launch.json
이 포함되어 있습니다.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "debug NestJS",
"runtimeExecutable": "yarn",
"osx": {
"args": ["start:dev"]
},
"windows": {
"args": ["start:dev_win"]
},
"console": "integratedTerminal",
"restart": true,
"autoAttachChildProcesses": true,
"cwd": "${workspaceFolder}/backend",
"env": {
"NODE_ENV": "development"
}
}
]
}
Run And Debug 탭을 클릭하여 debug Nest.JS
로 서버를 기동하십시오.
Last updated