I have multiple databases and I want to connect all databases in Node.js when my app initialize
const PouchDB = require('pouchdb');
exports.connectDB = (files) => {
let db = {};
let options = {};
files.forEach((file, i) => {
db[file.name] = new PouchDB(file.path, options);
if (files.length === i + 1) {
return db;
}
});
}
It's returning db as undefined.