I'm stuck in Challenge: Use the .env File even it show up as expect

Tell us what’s happening:
Describe your issue in detail here.
I config everything in repl right, i check with url/json and it changed to uppercase i don’t know why it still not pass

Your project link(s)

solution: boilerplate-express-6 - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36

Challenge: Use the .env File

Link to the challenge:

const mySecret = process.env['MESSAGE_STYLE']

app.get("/json", function(req, res) {
  if (mySecret === "uppercase") {
  response = "Hello json".toUpperCase();
} else {
  response = "Hello json";
  // res.json({"message": response})

You are checking the value of 'MESSAGE_STYLE' out in the global space for this app, which means that line is only run once. However, the test suite changes the value of this environment variable while your app is running. You need to check the value of the environment variable every time the GET request runs.

1 Like

Thank you Jeremy I forgot about sequence, it works. May god bless you :smiley:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.