.env file solution not being accepted

Tell us what’s happening:

Your code so far




app.get("/json", (req, res) => {
  if (process.env.MESSAGE_STYLE == "uppercase") {
  response = "Hello World".toUpperCase();
  } else {
  response = "Hello World";
    "message": response


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:
https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/use-the--env-filePreformatted text

why Hello World? it never pass if you use that

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.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Hello, @kadarsh115, The challenge asked you to use hello json. Not hello world. That is why it won’t be pass

" The response object should become {"message": "HELLO JSON"} ."

declare ‘response’ inside the handler function

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