Basic Node and Express - Use the .env File

Tell us what’s happening:
Describe your issue in detail here.

Even if I do the exercise well it does not consider it resolved, how can I go on?
I am a bit perprello and I have stopped here since yesterday.
in the “/ json” gives me {“message”: “HELLO JSON”}
if I change the environment variable instead {“message”: “Hello json”}
please help me i want to move on.

Your project link(s)


Your browser information:

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

Challenge: Basic Node and Express - Use the .env File

Link to the challenge:

Create a .env file in the root of your project directory, and store the variable MESSAGE_STYLE=uppercase in it.

Then, in the /json GET route handler you created in the last challenge, transform the response object’s message to uppercase if process.env.MESSAGE_STYLE equals uppercase. The response object should either be {“message”: “Hello json”} or {“message”: “HELLO JSON”}, depending on the MESSAGE_STYLE value.

Note: If you are using Replit, you cannot create a .env file. Instead, use the built-in SECRETS tab to add the variable.

Note the text “…if process.env.MESSAGE_STYLE equals uppercase…” in the assignment description above. How do you code that in JavaScript? Is that what you have in your Replit code?

Also, make sure that, since you are using the Replit you need to use the built-in SECRETS tab to add the variable.

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