Tell us what’s happening:
Describe your issue in detail here.
I am trying to do the challenge using .env file. I am using replit and have made the secret as explained rather than creating a .env file. I then have a const value,
const MYSECRET = process.env['MESSAGE_STYLE']
then
app.get('/json', (req, res) => {
if(MYSECRET === 'uppercase') {
resp = {"message": "Hello json".toUpperCase() }
res.json(resp)
console.log(resp)
} else {
res.json({"message": "Hello json" })
}
})
Ive logged the response to console to ensure it is changing to uppercase. but the test still fails saying
The response of the endpoint
/json
should change according to the environment variable
MESSAGE_STYLE
Your project link(s)
solution: boilerplate-express - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36
Challenge: Use the .env File
Link to the challenge: