Enhance application structure: Add runtime configuration for environment variables, integrate new dependencies for Cloudinary and UI components, and refactor member management features including improved forms and member dashboard. Update styles and layout for better user experience.
This commit is contained in:
parent
6e7e27ac4e
commit
e4a0a9ab0f
61 changed files with 7902 additions and 950 deletions
24
server/utils/mongoose.js
Normal file
24
server/utils/mongoose.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import mongoose from 'mongoose';
|
||||
|
||||
let isConnected = false;
|
||||
|
||||
export const connectDB = async () => {
|
||||
if (isConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
const MONGODB_URI = process.env.NUXT_MONGODB_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/ghostguild';
|
||||
|
||||
try {
|
||||
await mongoose.connect(MONGODB_URI, {
|
||||
serverSelectionTimeoutMS: 5000,
|
||||
});
|
||||
isConnected = true;
|
||||
console.log('MongoDB connected successfully');
|
||||
} catch (error) {
|
||||
console.error('MongoDB connection error:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export default connectDB;
|
||||
Loading…
Add table
Add a link
Reference in a new issue