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/107.0.0.0 Safari/537.36

Challenge: Basic Node and Express - Serve Static Assets

Link to the challenge:

Screenshot_20221202_122040
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) => {
res.json({
message: “Hello json”
process.env.MESSAGE_STYLE
});
});

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

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

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

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

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") {
  
    res.json({
      message: "Hello json".toUpperCase()
    });
  
  } else {
    res.json({
      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.

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