Basic Node and Express (Use the .env File.)

Basic Node and Express (Use the .env File.)
0

#1

It’s giving an error : Unexpected token r in JSON at position 0…

app.get('/json', function(req, res){
   if(process.env.MESSAGE_STYLE === "uppercase"){
      res.join({"message" : "HELLO JSON"});
   }
   else{
    res.join({"message" : "hello json"});
   }
 });

I've stored the variable MESSAGE_STYLE in the .env file..

#2
res.join({"message" : "HELLO JSON"});

Read your code carefully.