Hello!
So, I have been stuck on this task for 2 days now. I still can’t solve the problem.
I keep getting “not found” output.
I have created the SECRET file in Replit, yet, I can’t seem to access my MESSAGE_STYLE variable in the myApp.js file.
Here’s my code so far;
app.get('/json', function (req, res) {
let response = "Hello json";
if(process.env.MESSAGE_STYLE === "uppercase;") {
res.json({"message": response.toUpperCase()})
}
else {res.json({"message": response})}
});
Any help would be appreciated. So that I can move ahead to the next challenge.

Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 11; TECNO LC7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Mobile Safari/537.36
Challenge: Basic Node and Express - Use the .env File
Link to the challenge:
ILM
2
your code seems correct, maybe please post the link to your code?
ILM
5
you have two handlers on the same route
app.get("/json", function (req, res) {
res.json({"message": "Hello json"})
});
app.get('/json', function (req, res){
let response = "Hello json";
if(process.env.MESSAGE_STYLE === "uppercase;") {
res.json({"message": response.toUpperCase()})
} else {
res.json({"message": response})
}
});
only one of them execute…
I commented out the first handler. I still get the same output.
Do I erase the first handler altogether?
ILM
7
what’s in your secrets tab?
I have the MESSAGE_STYLE key and I set its value to “uppercase”.
ILM
9
Without quotes?
If that’s it, I have no idea why it doesn’t passes.
ILM
10
no wait, I know
what do you have in the quotes here?
Yeah. Without quotes.
Sorry, but I do not quite get the other question.
ILM
12
check what you have in the quotes, what are you comparing the variable to?
I’ve checked.
I have uppercase in there.
The secrets file has uppercase as value. It’s same with the process.env.MESSAGE_STYLE comparison
ILM
14
don’t you have an extra character inside the quotes?
The semi-colon.
I removed it. Same output.
ILM
16
what link are you submitting?
ILM
17
because with this last change, I can submit your live app url link and pass
at this point it can be also a cache issue, if it keeps not passin try to hard reload the freecodecamp site
1 Like
The live link that appears after i run the code.
It displays “not found”
However, I submitted like that but it didn’t pass.
Ok.
I refreshed and resubmitted.
It’s passed now!
Thank you!
1 Like
system
Closed
21
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.