몽고DB를 mongoose를 이용해서 app에 연결하기 위해 connect해주는 코드를 작성하고 연결이 잘 되었는지 확인해주기위해
run 했더니...
Example app listening at http://localhost:8080
{ MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster.
One common reason is that you're trying to access the database from an IP that isn't whitelisted.
Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.
mongodb.com/security-whitelist/
at NativeConnection.Connection.openUri (C:\Users\kjy59\Documents\test\node_modules\mongoose\lib
\connection.js:800:32)
같이 cluster에 연결할수 없다고 메시지를 알려준다.
에러가 나타난 이유를 짐작해 보아서는 내 IP address가 제대로 할당이 안된 원인으로 보인다.
그래서
mongoDB사이트에서 'Network Access'로 들어가서
위 이미지처럼 동그라미 처놓은 버튼을 눌러서 현재 나의 IP를 등록하게 하고 Confirm을 눌러준다.
그리고 pending이라는 문구가보이는 작업이 완료되고나서 다시 run을 해보자.
연결이 성공했을때 내가 console하도록 작성한 메시지인 'MongDB Connected...'가 잘 출력되었다.