Skip to content

Commit e686f43

Browse files
Mongodb atlas configured
1 parent 5b382dc commit e686f43

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

Official_Website/.example.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MONGO_URI=""

Official_Website/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import dotenv from 'dotenv';
12
import express from 'express';
23
import bodyParser from 'body-parser';
34
import cors from 'cors';
@@ -8,11 +9,10 @@ import Feedback from './models/feedback.js';
89

910
app.use(bodyParser.json());
1011
app.use(cors());
11-
12-
const URL='mongodb://localhost:27017/feedbackGSSCO';
12+
dotenv.config();
1313

1414
const main = async()=>{
15-
await mongoose.connect(URL)
15+
await mongoose.connect(process.env.MONGO_URI)
1616
.then(() => console.log("MongoDB connected"))
1717
.catch((err) => console.log(err));
1818
}

Official_Website/package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Official_Website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"description": "",
1212
"dependencies": {
1313
"cors": "^2.8.5",
14+
"dotenv": "^16.4.5",
1415
"express": "^4.19.2",
1516
"mongoose": "^8.4.1"
1617
},

0 commit comments

Comments
 (0)