Skip to content

Commit

Permalink
Update dependencies and add preline library
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranavtej committed Nov 28, 2023
1 parent d3afccb commit b66c4e9
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 88 deletions.
42 changes: 21 additions & 21 deletions connection.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
const mongoose = require('mongoose');
const dotenv = require('dotenv');
// const mongoose = require('mongoose');
// const dotenv = require('dotenv');

// Load the environment variables from .env file
dotenv.config();
// // Load the environment variables from .env file
// dotenv.config();

// MongoDB connection URL
const mongoUrl = `mongodb://${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_DATABASE}`;
// // MongoDB connection URL
// const mongoUrl = `mongodb://${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_DATABASE}`;

// Set up MongoDB connection
mongoose.connect(mongoUrl, {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
});
// // Set up MongoDB connection
// mongoose.connect(mongoUrl, {
// useNewUrlParser: true,
// useUnifiedTopology: true,
// useCreateIndex: true,
// });

const db = mongoose.connection;
// const db = mongoose.connection;

db.on('error', (error) => {
console.error('MongoDB connection error:', error);
process.exit(1); // Exit process on connection error
});
// db.on('error', (error) => {
// console.error('MongoDB connection error:', error);
// process.exit(1); // Exit process on connection error
// });

db.once('open', () => {
console.log('Connected to MongoDB');
});
// db.once('open', () => {
// console.log('Connected to MongoDB');
// });

module.exports = mongoose;
// module.exports = mongoose;
Loading

0 comments on commit b66c4e9

Please sign in to comment.