"Use the .env file" challenge working but not passing tests

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:

Hello there,

Yes, you were supposed to create one.

This is similar to: Node and Express Json response Error - JavaScript - The freeCodeCamp Forum

Currently, the issue with your code is the logical runtime. That is, at runtime, this code runs a total of once, and never again:

var message = {"message":"Hello json"}

    if (process.env.MESSAGE_STYLE === "uppercase") {
       message.message = message.message.toUpperCase();
    }

This logic needs to be changed so that, depending on the MESSAGE_STYLE state, the response of /json will be different.

Hope this helps

Thank you! That worked, and makes sense. I should have thought of that.