Basic Node and Express - Use the .env File

Tell us what’s happening:

app.get(‘/json’, (req, res) => {
var message =“”;
if (process.env.MESSAGE_STYLE === “uppercase”) {
message = “Hello json”.toUpperCase();
}else{
message = “Hello json”;
}
res.json({ message: message});
});

###Your project link(s)

solution: http://localhost:3000/json

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36

Challenge Information:

Basic Node and Express - Use the .env File

hi there, what is your question?

Don’t submit the URL with the /json path. Just the root http://localhost:3000


The use of var suggests to me you may have copied this code from somewhere. Only old code uses var these days. Don’t copy random code you find.