Download server/db.js from eznd/bao: direct link, hf CLI and curl.
- Browser
- Download file 434 Bytes
-
https://huggingface.co/spaces/eznd/bao/resolve/main/server/db.js
- Command line
-
hf download hf://spaces/eznd/bao/server/db.js
-
curl -L -o db.js https://huggingface.co/spaces/eznd/bao/resolve/main/server/db.js
434 Bytes
| require('dotenv').config(); | |
| const mongoose = require('mongoose'); | |
| const MONGODB_URI = process.env.MONGO_URI || process.env.MONGODB_URI; | |
| async function connectDB() { | |
| try { | |
| await mongoose.connect(MONGODB_URI); | |
| console.log('MongoDB connected successfully'); | |
| } catch (error) { | |
| console.error('MongoDB connection error:', error); | |
| process.exit(1); | |
| } | |
| } | |
| module.exports = { connectDB, mongoose }; | |