Outdated solution doesn't work anymore + Suggestion

Tell us what’s happening:
The existing solution for this challenge is unclear plus it seem like it’s now outdated and is not working anymore.

My logic:

You can use the .toUpperCase() method to turn a string into all capital letters.

From the last challenge you have to modify the code so that it will check if the value of the environment variable stored in the key MESSAGE_STYLE equals to “uppercase” using the if...else statement:

if (process.env.MESSAGE_STYLE === "uppercase")

If that condition is truthy you will have to execute a route handler using the res.json() method and pass the object {"message": "Hello json".toUpperCase()} as an argument, otherwise (else) you will pass the object {"message": "Hello json"} as an argument as follows:

Your code so far

app.get('/json', (req, res) => {
  if (process.env.MESSAGE_STYLE === 'uppercase')
    res.json({"message": "Hello json".toUpperCase()})
    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/100.0.4896.127 Safari/537.36

Challenge: Use the .env File

Link to the challenge:

the hint doesn’t have the solution right now, it has an explanation and example, that’s why it doesn’t work if you copy and paste

Aha, thanks, I got confused between the two.
Well, there’s my solution and my take on it as I know how frustrated one can be while stuck at a challenge. :slight_smile: