Tell us what’s happening:
I do not understand why it does not allow me to advance the system, when entering the link of my solution the following error appears:
// running tests
The response of the endpoint /json should change according to the environment variable MESSAGE_STYLE
// tests completed
I think I’m doing the right thing because my code works, I’ve even changed the code for these variants:
// Test 01
const mySecret = process.env['MESSAGE_STYLE']
var wordChange = "Hello json"
if (mySecret === "uppercase") {
wordChange = wordChange.toUpperCase()
}
app.get("/json", (req, res) => {
res.json({
"message": wordChange
})
})
// Test 02
if (process.env.MESSAGE_STYLE === "uppercase") {
app.get("/json", (req, res) => {
res.json({
"message": "HELLO JSON"
})
})
} else {
app.get("/json", (req, res) => {
res.json({
"message": "Hello json"
})
})
}
and they also work!, but when you enter the link to complete the challenge the same message appears.
“Note: If you are using Replit, you cannot create a .env file. Instead, use the built-in SECRETS tab to add the variable.”
I used Replit.
Your project link(s)
solution: https://replit.com/@hrendonc/boilerplate-express-2
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.40
Challenge: Use the .env File
Link to the challenge: