Why i cant complete this challenge? Use the .env File

Tell us what’s happening:
Describe your issue in detail here.

on hint page, example like this

if (process.env.VAR_NAME === "allCaps") {
  response = "Hello World".toUpperCase();
} else {
  response = "Hello World";
}

but when i try to join with my code, the result has true. but fcc dont accept it.

this is my code:

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

Your project link(s)

solution: https://replit.com/@nawaytes/boilerplate-express

Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

Hello there,

The instructions:

The response object should either be {"message": "Hello json"} or {"message": "HELLO JSON"}

You have copied from the hint example, not the answer.

Hope this helps

1 Like

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