Tell us what’s happening:
I’ve seen a number of posts about this challenge, but they don’t seem to address my situation. I’m trying to do this challenge in Repl.it, and I couldn’t find the .env file, so I created one. When I open https://boilerplate-express-1.hathaway2010.repl.co/json, sure enough, it reads {“message”:“HELLO JSON”}, but I can’t seem to pass the test. I’ve done as was suggested on the Hints page and on the forum and replaced the “fcc-express-bground” field with the suggested link. I’ve tried forking the app, too, and several versions of the code below.
I use Chrome. Thanks so much for any help.
Your code so far
in the env file:
MESSAGE_STYLE=uppercase
in the app:
var absolutePath = __dirname + "/views/index.html"
app.get("/", (req, res) => {res.sendFile(absolutePath)})
app.use(express.static(__dirname + "/public"));
var message = {"message":"Hello json"}
if (process.env.MESSAGE_STYLE === "uppercase") {
message.message = message.message.toUpperCase();
}
app.get("/json", (req, res) => {
res.json(message)
})
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
.
Challenge: Use the .env File
Link to the challenge: