*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:
nbValks
December 2, 2022, 12:22am
3
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.
nbValks
December 2, 2022, 12:37am
5
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
nbValks
December 12, 2022, 1:27pm
9
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?
hbar1st
December 12, 2022, 2:58pm
11
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.
system
Closed
June 13, 2023, 2:59am
12
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.