필요한 모듈 설치
npm install config
파일 생성
1. 루트 디렉토리에 config 라는 폴더 생성하고 그 안에 JSON이나 YAML 형식의 파일 생성
config/default.yaml
2. config 디렉토리 안에 default.yml, development.yml, 그리고 production.yml 파일 생성
default.yml : 기본 설정 => 개발 환경, 운영 환경 설정에 모두 적용
development.yml : default.yml 설정 + 개발 환경에서 필요한 정보
production.yml : default.yml 설정 + 운영 환경에서 필요한 정보
default.yml
server:
port: 3000
db:
type: 'postgres'
port: 5432
database: 'board-app'
jwt:
expiresIn: 3600
development.yml
db:
host: 'localhost'
username: 'postgres'
password: 'postgres'
synchronize: true
jwt:
secret: 'Secret1234'
synchronize: true 서버가 시작될 때 entity 변경사항 적용 (개발환경에서만 true로)
production.yml
db:
synchronize: false