Code not working in .env file for express server

Tell us what’s happening:
I have created a local.env file with code:

var express = require(‘express’);
var app = express();
console.log(“Hello World”);
// --> 7) Mount the Logger middleware here

var absolutePath = __dirname + ‘/views/index.html’;
var assets = __dirname + ‘/public’;
app.get(’/json’,(req,res) => {
var response = “Hello json”;
if(process.env.MESSAGE_STYLE == “uppercase”){
response = response.toUpperCase();

message: response});
This is my code. But, it still gives message Hello json here,

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36.

Link to the challenge:

Hi @mkd63, I’d try removing the quotes around "upppercase" in your .env file

Tried it, still not working
current code in .env file:

current code in app.js:
app.get("/json", function(req, res) {
process.env.MESSAGE_STYLE == “uppercase”
? res.json({“message”: (“Hello json”).toUpperCase()})
: res.json({“message”: “Hello json”})

Hmm, weird. I cloned your app and it’s working for me (links below). But I agree it’s not the quotes around “uppercase”; that doesn’t seem to make a difference. I noticed you have a duplicate route on line 10 that may be contributing to the problem. I noticed a few times it would return lowercase first then uppercase shortly after.

Yeah ! I left it by mistake last time i edited. But, removing it still it does not seem to work.
I got exact same code now still not working.

I’m thinking it must have something to do with your .env file. I just cloned your app again, added the .env file, and it worked.

I noticed you have a local.env file. The file should be just .env, and once you create it, Glitch will put a little ‘key’ icon next to it to indicate it’s private. (Also, semicolons aren’t necessary in the .env file). It should look like this:


I’m having this same problem. When I removed the quotes from my challenge and when I visited it, it says uppercase not defined. If I add the qoutes it doesn’t change to the Json object to uppercase hence the challenge won’t pass. I need help