Tell us what’s happening:
Basic Node and Express - Use the .env File
Hi
Can someone help me with “.evn File”, I am stuck if I click SHOW button it says “Not Found”.
I have tried many times, can anyone help to correct my code if they something wrong.
Your code so far
/** 6) Use the .env file to configure the app */
app.get("/json", (req, res) =>{
if(process.evn.MESSAGE_STYLE === "uppercase"){
res.json({ "message": "HELLO JSON" })
}
else {
res.json({ "message": "Hello json" })
};
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
.
Challenge: undefined
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
Sky020
April 16, 2020, 7:35pm
2
Welcome, menzi.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
Note: Backticks are not single quotes.
Thanks for the information
Sky020
April 18, 2020, 11:25am
4
I am not sure if you have solved this, but you have a typo:
Can someone help me with “.evn File”,
process.evn.MESSAGE_STYLE
It is a .env
file.
Hope this helps
Thanks, I have notice that and the code is working