[Node.js] "UnhandledPromiseRejectionWarning: Unhandled promise rejection" 해결


[Node.js]

문제상황: Node.js를 사용하여 웹 서버를 개발하고, 다음과 같은 코드를 작성하여 데이터베이스에 접근하려고 했습니다. const mongoose = require('mongoose'); const connectionString = 'mongodb://localhost:27017/myDatabase'; mongoose.connect(connectionString); mongoose.connection.on('connected', () => { console.log('Connected to MongoDB'); }); mongoose.connection.on('error', err => { console.log('Error co..


원문링크 : [Node.js] "UnhandledPromiseRejectionWarning: Unhandled promise rejection" 해결