#9 비밀 설정 정보 관리
2022. 8. 3. 14:01ㆍTIL/따라하며 배우는 노드 리액트
728x90
[인프런] 따라하며 배우는 노드, 리액트 시리즈 - 기본강의를 들으며 정리한 내용입니다.
1. config 폴더생성
1-1) dev.js 파일 생성 (로컬 환경에서 사용) - development
module.exports={
mongoURI: 'mongodb+srv://<password>@boiler-plate.af6zkai.mongodb.net/?retryWrites=true&w=majority'
}
1-2) prod.js 파일 생성 (배포한 후 사용) - production
module.exports={
mongoURI: process.env.MONGO_URI
}
1-3) key.js 파일 생성
if(process.env.NODE_ENV === 'production'){
module.exports = require('./prod');
}else {
module.exports = require('./dev');
}
2. index.js 파일 수정
const config = require('./config/key');
config.mongoURI
3. .gitignore 파일에 dev.js 추가하기
'TIL > 따라하며 배우는 노드 리액트' 카테고리의 다른 글
#11,12 로그인 기능 with Bcrypt, jsonwebtoken (0) | 2022.08.04 |
---|---|
#10 Bcrypt로 비밀번호 암호화 하기 (0) | 2022.08.03 |
#8 Nodemon 설치 (0) | 2022.08.03 |
#7 BodyParser & PostMan & 회원 가입 기능 (0) | 2022.08.03 |
#5 Git 설치 / #6 SSH를 이용해 GITHUB 연결하기 (0) | 2022.08.03 |