Basic Node and Express - Use the .env File

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

I am using Replit, i don’t know how to solve this challenge
Your browser information:

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

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

Link to the challenge:

find the Tools tab, then Secrets icon

image

const mySecret = process.env[‘MESSAGE_STYLE’]

app.get(‘/json’, (req, res) => {
if (mySecret === ‘uppercase’) {
res.json({ “message”: “HELLO JSON” });
} else {
res.json({ “message”: “Hello Json” });
}
})

i try this one but failed

res.json({ “message”: “Hello Json” });

The response object should either be {"message": "Hello json"} or {"message": "HELLO JSON"} ,

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