Freecodecamp Challenge - Use the .env File

Challenge link: https://www.freecodecamp.org/learn/back-end-development-and-apis/basic-node-and-express/use-the--env-file

I think I wrote the codes correctly and when I check it by typing /json, there is no error but freecodecamp doesn’t accept. Could you help me?

I installed the required npm package and included it in my project:

require('dotenv').config();
app.get("/json", (req,res) => {
  if (process.env["MESSAGE_STYLE"] === "uppercase") {
    res.json({"message" : "HELLO JSON"})
  } else {
    res.json({"message" : "HELLO json"})
  }
})

Although I write correctly code in the .env package, it does not accept

image

that doesn’t look correct
compare the string HELLO json with the one they asked for…

I missed something so simple. I am so sorry. Could you delete this topic?

we could delete it but since I already responded to you, deleting it would be also deleting my response. Why do you want to do that?

Your comment provided my solution. I couldn’t pass the test because of a small mistake that I overlooked. That’s why I’d like to delete that topic. Thanks by the way

I’m happy to help but deleting the topic would also mean that no one else can read this who hits a similar issue.
(and would also discourage people from helping since after they helped, their contribution is erased)

Aiming for perfection will get you nowhere in development, mistakes are part of the process. There is nothing to hide and nothing to be ashamed of.

In fact, for every question asked and answered you save potentially hundreds if not thousands of other developers from having to ask the same question. That is why Stack Overflow is useful because people do not just delete their question when it gets answered. If people did that no one would be able to use it for anything and it would have died long ago.

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