Tell us what’s happening:
Hello
Im working on the “Use the .env File” challenge from BackEnd development and APIs, I get te requested answer when I run it locally, also when I run it from replit.com (Which is what I have used for all previous challenges) the FCC checker keeps marking it as not passed: " The response of the endpoint /json
should change according to the environment variable MESSAGE_STYLE
"
Any suggestions or help?
Your project link(s)
solution: https://replit.com/@juliantabares1/boilerplate-express-1json
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36
Challenge: Use the .env File
this is my code:
process.env.MESSAGE_STYLE = "uppercase"
const fontStyle = process.env.MESSAGE_STYLE
let absolutePath = __dirname + "/views/index.html"
let middleDirname = __dirname + "/public"
app.get("/", function (req, res) {
res.sendFile(absolutePath)
})
app.get("/json", function (req, res) {
let answer = { "message": "Hello json" }
if (fontStyle === "uppercase") {
answer.message = answer.message.toUpperCase()
return (res.json(answer));
} else {
res.json(answer);
}
});