Skip to content

Commit 8a6112e

Browse files
authored
Update part3c.md
In the .env file - MONGODB_URL="mon...". In the models/note.js file and further - const url = process.env.MONGODB_URI. Since MONGODB_URL was used only at the beginning, and MONGODB_URI is also in the repository, I replaced MONGODB_URL with MONGODB_URI
1 parent 6b66a5c commit 8a6112e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/3/en/part3c.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ const Note = mongoose.model('Note', noteSchema)
392392
To avoid authentication issues with the password variable in index.js, we need to create a .env file by running npm install dotenv in the command line. Then, let's create the .env file in the root of your directory. In that file, you should place your URI:
393393

394394
```
395-
MONGODB_URL="mongodb+srv://fullstack:[email protected]/?retryWrites=true&w=majority&appName=db"
395+
MONGODB_URI="mongodb+srv://fullstack:[email protected]/?retryWrites=true&w=majority&appName=db"
396396
```
397397
Don't forget to replace the string with your details.
398398
Once the .env file is ready, remember to add it to your .gitignore file to prevent pushing the password to Git:
@@ -404,7 +404,7 @@ Once the .env file is ready, remember to add it to your .gitignore file to preve
404404
Then, in your index.js file, make the necessary changes with the following line so that your code can access the URL in your .env file:
405405

406406
```
407-
const url = process.env.MONGODB_URL;
407+
const url = process.env.MONGODB_URI;
408408
409409
```
410410

0 commit comments

Comments
 (0)