Stuck at .env file

*Tell us what’s happening:
i basically have no idea of what the .env project is about i got a hint

if (process.env.VAR_NAME === “allCaps”) {
response = “Hello World”.toUpperCase();
} else {
response = “Hello World”;

but it still doesn’t help
i will appreciate if someone can explain how to solve this particular challenge in precision

Your project link(s)

solution: boilerplate-express (1) - Replit

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 - Serve Static Assets

Link to the challenge:

The challenge you linked at the bottom of your post has nothing to do with the code you wrote above. I will assume you meant the Use the .env File challenge.

If so, since you are using Replit, then according to the instructions, you will need to use the Secrets tab to add a variable named MESSAGE_STYLE and assign the value uppercase.

Once that is done, inside the /json GET route handler created in the previous challenge, you need to make use of the variable, by referencing process.env.MESSAGE_STYLE and then return the correct response (a JSON response you should have already learned how to do from the previous challenge).

With your current code, you are checking to see if an environment variable named VAR_NAME is strictly equal to the string allCaps, but that is not the correct environment variable name or the value you are supposed to be comparing its value against (per instructions).

The instructions are very clear about the JSON response that should be returned. It involves sending back an object with a property named message and a value of either "Hello json" or "HELLO JSON". Currently, your code is not returning any kind of response. It does appear you have tried to assign the string "HELLO WORLD" or "Hello World" to a variable named response, but that is no where close to what the instructions have told you to do.

Try to rewrite the correct code this time and let us know if you are successful or not.

i saw this panel
pls can guide how to go about it

what should i insert at the ‘value’ place

The variable name goes in the key field and the variable value goes in the value field.

i got that part

app.get(“/json”, (req, res) => {
message: “Hello json”

i’m stuck at trying to call it this way
thank you for the efforts

app.get(“/json”, (req, res) => {
message: “Hello json”
const mySecret = process.env[‘MESSAGE_STYLE’]

i used this method as well but it’s not working

Do you understand what the syntax of a JS object looks like?

Also, do you understand what the instructions for this particular challenge are asking you to do?

i don’t really understand the instructions clearly
i’ve stuck at this challenge for a day

Have you gone through the entire JavaScript Algorithms and Data Structures part of the curriculum yet? If not, I strongly advise you do that before starting the NodeJS challenges.

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

app.get("/", function(req, res){
  res.sendFile(__dirname + "/views/index.html");
app.use("/public", express.static(__dirname + "/public"))

if (process.env.MESSAGE_STYLE === "uppercase") {
      message: "Hello json".toUpperCase()
  } else {
      message: "Hello json"


 module.exports = app;

I was able to figure out the issue to this level and now i got {“message”:“HELLO JSON”} as the output as instructed by fcc but
my code above still fails the fcc test .
counting on your reply ,thank you

Why did you put these lines here?

so this question doesn’t get lost (as the original question was already answered), you may want to open a new topic and ask there.