Basic Node and Express - Use the .env File

Tell us what’s happening:
Describe your issue in detail here.
COULD ANYONE HELP ME REGARDING THE CODE PART
IT’S SHOWING
The response of the endpoint

/json

should change according to the environment variable

MESSAGE_STYLE

(Test timed out)

Your project link(s)

solution: boilerplate-express - Replit

Your browser information:

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

Challenge: Basic Node and Express - Use the .env File

Link to the challenge:

Your Replit code

  res.json({
      message: "Hello json"
  });

sends a message. But, the assignment is that the message needs to be uppercase based upon the process.env.MESSAGE_STYLE variable. So, modify the message value before sending the message.

already did it not working

Your code can be as follows and this needs to be within the GET request so that when the request is made in the browser with this url http://localhost:3000/json the response is displayed depending upon the MESSAGE_STYLE.

let myMessage = "Hello json"
if uppercase
    myMessage = myMessage converted to uppercase
res.json({ message: myMessage })

NOTE the above is just a pseudocode.

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