freeCodeCamp Challenge Guide: Use the .env File

Cuéntanos qué está pasando:
I do not understand why not the requirements, I think the solution is fine, can someone help me to see if I have something wrong? I am transforming the value of the object to uppercase as requested but it does not pass the requirements.

Tu código hasta el momento

app.get("/", function (req, res) {
  res.sendFile(absolutePath);
})

app.use("/public", express.static(__dirname + "/public"));

const mySecret = process.env['MESSAGE_STYLE'];
 let respuesta;
console.log(mySecret);
  if(process.env['MESSAGE_STYLE'] === "uppercase"){
   respuesta = "Hello json".toUpperCase();
    console.log(respuesta);
  }else{
    respuesta = "Hello json";
    console.log(respuesta)
  }

app.get("/json",(req,res) => {
  res.json({"message":`${respuesta}`});
});

The response you are sending is correct and changes depending on the value of the variable but it does not pass the requirements
Captura de pantalla (114)

Link to replit
https://replit.com/@EduMC14/boilerplate-expressCurso2#myApp.js

Información de tu navegador:

El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36

Desafío: Node y Express Basico - Usa el archivo .env

Enlaza al desafío:

Let’s see if I understood what you mean? If so, I still can’t pass the tests

app.get("/json",(req,res) => {
 let respuesta;
  if(process.env['MESSAGE_STYLE'] === "uppercase"){
   respuesta = "Hello json".toUpperCase();
  }else{
    respuesta = "Hello json";
  }
  res.json({"message":`${respuesta}`});
});

If I have it saved in the secrets tab, but I still can’t pass the tests, am I doing something else wrong?
https://replit.com/@EduMC14/boilerplate-expressCurso2#myApp.js


This is how it is stored

Yes, of course, I’ve still tried to continue with the next challenge, but I didn’t pass the tests, I’m going to try to do it locally to see if I pass the tests that way.

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