[JITERA] Add comment to database connection configuration
Overview
This pull request updates the db.js file in the config directory of the book API project. The purpose of this update is to enhance code readability and maintainability by adding a comment that explains the purpose of the database connection configuration.
Changes
-
Added a comment: A comment has been added at the top of the
db.jsfile to clarify that this file contains the configuration for connecting to the MongoDB database using Mongoose. This will help future developers understand the purpose of the file at a glance.
// This file contains the configuration for connecting to the MongoDB database using Mongoose.
const mongoose = require('mongoose');
const connectDB = async () => {
try {
await mongoose.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
console.log('MongoDB connected');
} catch (error) {
console.error('Error connecting to MongoDB:', error);
process.exit(1);
}
};
module.exports = connectDB;