Basic Node and Express - Use the .env File

Tell us what’s happening:
On the live preview, the json response is looking uppercase, but the test is failing

Your project link(s)

solution: boilerplate-express - Replit

Your browser information:

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

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

can you post a link to the challenge you are on?
(the code in the replit doesn’t match the name of your post so I’m confused)

It should be ‘Hello json’ if NOT uppercase, not ‘Hello Json’. That might be causing the challenge to fail.

Changed it but still not passing

This is my actual working code:

app.get('/json', function(req, res) {
  var mySecret = process.env.MESSAGE_STYLE;
  if (mySecret === "uppercase") {
      "message": "HELLO JSON"
  else {
      "message": "Hello Json"

I did not understand @igorgetmeabrain explanation sorry

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

There are only two allowable values for that string. Yours does not exactly match

1 Like

Thanks, never realized the capital J

1 Like

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