[인프런] 따라하며 배우는 노드, 리액트 시리즈 - 기본강의 - 9강
비밀 정보 보호
DB 정보같은 비밀 정보는 보호되어야 한다
![](https://velog.velcdn.com/images%2Fjaun_%2Fpost%2Ffcc75e1e-90cb-4295-b582-6f16fa42349a%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.28.30.png)
소스코드상에 DB 정보가 담겨있으면 github 같은 코드를 확인 할 수 있는 곳에 업로드 되면 보안이 취약해진다.
Local & Production
local 과 Production 에서 정보를 따로 관리해야한다.
![](https://velog.velcdn.com/images%2Fjaun_%2Fpost%2Fef5363db-961a-45e0-9156-e3c4adcaeb9d%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.31.16.png)
dev.js ( Local 환경 )
![](https://velog.velcdn.com/images%2Fjaun_%2Fpost%2F03a76e60-756f-436d-9904-7e2150077809%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.32.43.png)
prod.js ( Production (배포) 환경 )
![](https://velog.velcdn.com/images%2Fjaun_%2Fpost%2Fd35d7a55-357e-4ee3-9bcc-170ee2afbcc5%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.34.15.png)
key.js (local 환경인지 prod 환경인지 체크해서 값 리턴)
![](https://velog.velcdn.com/images%2Fjaun_%2Fpost%2Fa76bda0d-60d6-4254-9e22-1acad7ff57b7%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.35.28.png)
index.js 에서 변수 선언
![](https://velog.velcdn.com/images%2Fjaun_%2Fpost%2Fd5d92e0a-6218-4ccc-a522-e5fa123b77c9%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.35.48.png)
index.js에서 mongoDB연결
config.mongoURI 입력
![](https://velog.velcdn.com/images%2Fjaun_%2Fpost%2F752924ff-07c9-4f41-9093-f468988e666f%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.37.12.png)