I am not able to understand what is wrong with my code

Tell us what’s happening:
Describe your issue in detail here.
i have added the variable in secrets tab…

const MESSAGE_STYLE = process.env['MESSAGE_STYLE'];

app.get('/json', function(req, res){
    if( MESSAGE_STYLE === 'caps' ){
      res
        .status(200)
        .json("HELLO JSON");
    } else {
     res
        .status(200)
        .json("Hello json");
    }   
    });

Your project link(s)

solution: https://replit.com/@wani118/boilerplate-express

Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

make sure you declare your variables in the smallest scope you need them

also this is not the value of the environment variable that is being tested

1 Like