From a7c2c85cf4e78e30526160c017624eef7849d96c Mon Sep 17 00:00:00 2001 From: strokh24 <Rokas.Stankunas@Student.Reutlingen-University.DE> Date: Mon, 7 Oct 2024 10:15:53 +0200 Subject: [PATCH] Changed DB connection to be taken from .env file; specified DB name --- mongodb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongodb.js b/mongodb.js index d5c632a..193e97b 100644 --- a/mongodb.js +++ b/mongodb.js @@ -4,7 +4,7 @@ const mongoose = require('mongoose'); async function connectDB() { try { // Connect using the MongoDB URI from environment variables - const conn = await mongoose.connect("mongodb://127.0.0.1:27017"); + const conn = await mongoose.connect(process.env.MONGO_URI || "mongodb://127.0.0.1:27017/todo_app"); console.log(`MongoDB connected: ${conn.connection.host}`); // Get the database object from the connection -- GitLab