Basic Node and Express - Use the .env File

I am not sure what I have done wrong in here. please help !

app.get('/json', function(req, res) {
      let message = "hello json";

      if (process.env["MESSAGE_STYLE"] == "uppercase") {
        message = message.toUpperCase();
      }

      res.json({"message": message});
    });

Challenge: Basic Node and Express - Use the .env File

Link to the challenge:

The syntax is indeed correct but the json response is not quite what is specified:

The response object should either be {"message": "Hello json"} or {"message": "HELLO JSON"} , depending on the MESSAGE_STYLE value.

1 Like

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