Setup environment variables with Node.js + Dotenv Tutorial

preview_player
Показать описание
In many application, it's always a good idea to set up environment variables to protect your tokens, passwords, db connection strings, etc. It's also great for having one reference to a variable that may change.
Рекомендации по теме
Комментарии
Автор

Tip: You can 'npm init -y' to automatically "enter out" all questions; it'll create a default package.json

Selrond
Автор

Thank you...this video just saved a project 5 years after it was made...who knew.

chibuezeebii
Автор

Great tip. Thank you for explaining this in a concise manner!

tyyist
Автор

Great stuff. Trying to get into node.js and your vids are really helping out. :)

TheEricBrian
Автор

Helped wrap my mind around this, thanks man!

tannaurus
Автор

I wrapped my mind around this, thank you

danielEpifanov
Автор

Thank you Dev! You explained that perfectly

PrestonL
Автор

Great video, good tips. You do a good job at explaining things that others assume the user will know about, such as the .gitignore. I know that technique takes a bit longer, but I remember when I first started learning this stuff and how much I appreciated when presenters would use a few assumptions as possible. I'm sure this will be helpful to many just getting started.

brycemartin
Автор

You got 1 more subscriber. Thanks for this video!

goyslee
Автор

Thank you for this Simple Short Explanation ... :)

arunkutz
Автор

this helped me with my playwright project I can now configure env variables!

DOM
Автор

Nicely explained... Didn't think it would be this easy

sonamtseringsherpa
Автор

snagged me as a subscriber because of this video. Keep up the good work!

codingmorrison
Автор

That's a really useful module. An equivalent to this would be running your index.js with the following command: node index.js`

leonidpyrlya
Автор

Thank you very much. Very much useful. I wanted to protect mongoDB password from mongoose connect.

JavedKhalil
Автор

Thank you. You showed me what the issue was for me, I was doing require('dontenv') intead of require('dotenv/config'). Without importing the config, you don't have access to the local config.env file from your project.

silviu.iordache
Автор

You just made me make .env file and a cup of coffee

dailymeow
Автор

Concise and informative. You're a great teacher. Though, a bit fast

simonkalu
Автор

Can you please tell me, Would there be different .env files for different environments? How can we trigger them from maven pom (React+Spring) app?

shriiikaant
Автор

hi criss, why I push to github I push too folder node_modules, if I use your same .gitignore??? command I was use: - git init -
git add . - git commit - git push origin master

tsxdaniel