Can't pass .env file section test

Couldn’t pass this section, although it is working fine on my localhost.

I am using local editor and localhost

Completed all the steps asked, installed dotenv npm package as well.

My code so far:

var express = require('express');

var app = express();


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

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

app.get('/', (req, res) => {

    res.sendFile(__dirname + '/views/index.html');


app.get('/json', (req, res) => {

    let obj = {"message" : "Hello json"}

    if (process.env.MESSAGE_STYLE = "uppercase") {


    } else {




.env file

Output is “HELLO JSON” on http://localhost:3000/json

Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

Double check. What does ‘toUpperCase’ actually do? What are you supposed to return?

I don’t think that you are actually returning a json for an object in the specified format.

Thank you!

I learned that toUpperCase returns a new string, and it doesn’t modify the original
So I did this

app.get('/json', (req, res) => {

    let obj = {"message": "Hello json"};


    if (process.env.MESSAGE_STYLE = "uppercase") {

        obj.message = obj.message.toUpperCase();




localhost:3000/json output is this


* "message": "HELLO JSON"


What am I missing now?
Still can’t pass the test. It says
The response of the endpoint /json should change according to the environment variable MESSAGE_STYLE

i have the same problem

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.