Summary
Keywords
Full Transcript
Learning Outcome: 1) How to set up an environment variable? Step 1: create an .env file in the root directory Step 2: define environment variable(S) using uppercase letters and underscore if more than one word. Example - PORT DATABASE_URL Step 3: Assign the values without double quotation and space PORT=3000 DATABASE_URL=mongodb+srv://medo:[email protected]/test?retryWrites=true&w=majority Step 4: you can make a comment using # # server port PORT=3000 Step 5: install dotenv package - npm install dotenv Step 6: require dotenv - require('dotenv').config(); Step 7: Access the env variables from anywhere using process.env.VARIABLE_NAME. Example – process.env.PORT; Optional: DotENV Extension - nice syntax highlighting in your .env files. node.js github link - https://github.com/anisul-Islam/NodeBasic command link video tutorial - https://youtu.be/kbyNSrhxuuI Node.js video series: https://www.youtube.com/playlist? list=PLgH5QX0i9K3r6ZGeyFnSv_YDxVON2P85m JavaScript Video series: https://www.youtube.com/playlist?list=PLgH5QX0i9K3qzryglMjcyEktz4q7ySunX bootstrap video series: https://www.youtube.com/playlist?list=PLgH5QX0i9K3oC_wmWEZa2xWxJauIRQ9kG HTML5 Course : https://www.youtube.com/playlist?list=PLgH5QX0i9K3oHBr5dsumGwjUxByN5Lnw3 CSS3 Course : https://www.youtube.com/playlist?list=PLgH5QX0i9K3qjCBXjTmv7Xeh8MDUUVJDO Subscribe : https://www.youtube.com/channel/UCEXwc6mNh7Lakj6lX-7a2Mg website : https://www.studywithanis.com Facebook : https://www.facebook.com/anisul2010s Facebook page : https://www.facebook.com/studywithanis/
