Download src/config/mongo.config.ts from lynfera/api: direct link, hf CLI and curl.
- Browser
- Download file 429 Bytes
-
https://huggingface.co/spaces/lynfera/api/resolve/main/src/config/mongo.config.ts
- Command line
-
hf download hf://spaces/lynfera/api/src/config/mongo.config.ts
-
curl -L -o mongo.config.ts https://huggingface.co/spaces/lynfera/api/resolve/main/src/config/mongo.config.ts
429 Bytes
| import { ENVS } from "@/config/env.config.js"; | |
| import mongoose from "mongoose"; | |
| const connectDB = async () => { | |
| try { | |
| const mongouri = ENVS.MONGO_URL; | |
| if (!mongouri) { | |
| throw new Error("MONGO_URI not found from .env."); | |
| } | |
| await mongoose.connect(mongouri); | |
| console.log("Database connected"); | |
| } catch (error) { | |
| console.log(" Database Connection Failed", error); | |
| process.exit(1); | |
| } | |
| }; | |
| export default connectDB; | |