Evaluator ignoring correct answer

Tell us what’s happening:

// running tests The response of the endpoint /json
should change according to the environment variable MESSAGE_STYLE
// tests completed

The response of the endpoint /json should change according to the environment variable MESSAGE_STYLE

Your code so far

https://glitch.com/~gainful-tamarind/json

var data = {"message": "Hello json"};
app.get("/json", function(req, res) {
   if (process.env.MESSAGE_STYLE === 'uppercase'){
    data.message = data.message.toUpperCase();
    res.json(data);
   } else {
    res.json(data);
   }
});

Your browser information:

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

Challenge: undefined

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/use-the-.env-file

  1. Double check your data object, there is something wrong with it.
  2. the “Double quotes” around Hello json and the “Single Quotes” around around uppercase are the fancy kind, not sure the technical term :rofl:

if you look close at the ones around “/json”… " not I think it is a mobile or Mac thing

Yeah it was the quotes around “uppercase” in the conditional.
Which were changed in my post. They are simple single quotes in the code.

Thanks.

1 Like