Tell us what’s happening:
I am trying to get response from if condition but only else block is getting executed.
Your project link(s)
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0.
Challenge: Use the .env File
Link to the challenge:
This is similar to:
Essentially, you are not following this part of the instructions:
Then, in the
/json GET route handler…
Hope this helps
I tried making the changes but its still ignoring the if condition and giving me the else condition. Can you please check for once where exactly I am wrong please.
This has to be “in the
/json GET route handler”:
const mySecret = process.env['MESSAGE_STYLE']
Think about when the script runs…
- Script is executed from top to bottom
mySecret is defined as being
app is defined with what to do when certain requests are made
If I make a request, it does not matter when or how, the value of
mySecret has been set in stone, because
const mySecret = ... only runs once (on initial start-up). No matter how many times I make a request which causes the callback function to run in the route handler, the
if condition will always be true.
Hope this clarifies
Thank you soo much for helping and taking time to explain me things. I have passed the test and completed the module.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.