Cannot pass the test .env file. Getting the right output but cannot pass test

Here is my code:
myApp.js

let express = require(‘express’);
let app = express();
require(‘dotenv’).config();

app.get(‘/json’, function(req,res){
let response = “Hello Json”;
if (process.env.MESSAGE_STYLE === “uppercase”) {
res.json({“message”: response.toUpperCase()});
} else {
res.json({“message”: response});
}
});

module.exports = app;

Here is my( .env file )
MESSAGE_STYLE=uppercase

if you are assigning a string to MESSAGE_STYLE then uppercase should be enclosed in quotes

Did enclosed it in quotes but still doesn’t pass.

I am still getting the same output whethe enclosed or not. It just don’t let me pass.

could you post your replit link so that i have a look at it

I am not sure if this link work – boilerplate-express-1 - Replit

your code produces correct output but you have used incorrect variable name its MESSAGE_STYLE not STYLE_MESSAGE

Yes. I made the first secret which is MESSAGE_STYLE= and the value = uppercase. I assume that maybe giving me error so I created another key STYLE_MESSAGE because replit says MESSAGE_STYLE has been used.

you should use correct variable name and delete the other

I have edited it.

that’s good, now it should pass

you should use this link (https://boilerplate-express-1.binovino.repl.co/) for the solution

It still won’t let me pass. I’ve tried
https://boilerplate-express-1.binovino.repl.co/json
https://boilerplate-express-1.binovino.repl.co

Try this code in Terminal: npm install fcc-express-bground

I also tried it locally but this one don’t work either.
http://localhost:3000
http://localhost:3000/json

But I am getting the right output. This getting so frustrating, I’ve read others solutions and applied it to mine but still doesn’t work.

Tried this https://boilerplate-express-1.binovino.repl.co/ doesn’t work.

It is installed and It will produce an error if it’s not there. Thank you anyway!

It’s a bit difficult to tell from a screenshot, but it look as though your message is set to
"Hello Json"

But the tests are expecting
"Hello json"
for the “not uppercase” version of the message.

Note the difference in the capitalisation.

1 Like

Thank you so much @KittyMac just when I’m about to give up you’re a life saver. I’ll be more careful as I move along.

Don’t worry - it’s the kind of problem that’s really hard to spot in your own code.
I’m glad the tests passed for you!