Cannot pass the test for this problem

My solution for the problem is the following:

var express = require('express');
var app = express();

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

app.get("/json", function(req,res) {
  res.json({"message": response});
 
});


when I run the code on replit and use the domain provided to route to the “/json” the message returned is uppercase as described but I can not seem to pass the test and that’s what I am confused about.

help would be appreciated.

Your project link(s)

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

Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

Thanks for the response,
I have updated my question to describe more about the problem I am facing.
along with the code, I have also added the MESSAGE_STYLE key value to replit secrets section.

iirc for the solution to pass, you had to do the conditional process inside the get callback.

1 Like

thanks,
finally done with it.

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