Not being able to access variable form .env file

require('dotenv').config()

let express = require('express');
let app = express();

console.log(process.env.MESSAGE_STYLE);

app.get("/", func1);
function func1(req,res){
    res.sendFile(__dirname+"/views/index.html")
}

app.use("/public", express.static(__dirname+"/public"));

app.get("/json", function(req, res) {
    const messageStyle = process.env.MESSAGE_STYLE;
    
    if (messageStyle === "uppercase") {
    res.json({"message": "HELLO JSON"});
    } else {
    res.json({"message": "Hello json"}); // Note the correct casing: “Hello json”
    }
    });
    
module.exports = app;

Here is the code for this challenge and I tried to see what is the value of the variable that I need to compare as you can see with the console.log(process.env.MESSAGE_STYLE)

But the output of that log is undefined in my console.
Can anyone enlighten me as to why is that?

The .env file is named demo.env and is in the root directory

what is the code in your .env file?

the file should be named just .env

thanks for responding. I got the program to work and it does I’ve the correct output locally, but it gets timed out on the tests and says the program does not change the output based on the value of the variable MESSAGE_STYLE

here is the updated code

require('dotenv').config()

let express = require('express');
let app = express();



app.get("/", func1);
function func1(req,res){
    res.sendFile(__dirname+"/views/index.html")
}

app.use("/public", express.static(__dirname+"/public"));

app.get("/json", function(req, res) {
    
    
    if (process.env.MESSAGE_STYLE === "uppercase") {
    res.json({"message": "HELLO JSON"});
    } 
    else {
    res.json({"message": "Hello json"}); // Note the correct casing: “Hello json”
    }
    });
    
module.exports = app;






and the code in my .env file is

MESSAGE_STYLE=uppercase

make sure you are submitting the right link, the code looks correct