Problem of Basic Node and Express - Use the .env File

Problem of Basic Node and Express - Use the .env File
0

#1

Hello all,
my code below works properly on Glitch but freecodecamp says “The response of “/json” does not change according to MESSAGE_STYLE”
Here is my code and below it the link for the problem.

pp.get("/json", function(req, res) {
    if (process.env.MESSAGE_STYLE === 'upercase'){return res.json({"message": "HELLO JSON"})}
      else {return res.json({"message":"Hello Json"})}
        })

#2

Not sure about the FCC challenge, but you have a typo here:

process.env.MESSAGE_STYLE === ‘upercase’ ‘uppercase’


#3

// This crispy solution is one slice-off
// :rofl:
app.get("/json", function(req,res){
let obj = {“message”: “Hello json”};
let myobj = {“message”: “Hello json”};
obj.message=obj.message.toUpperCase();
(process.env.MESSAGE_STYLE==“uppercase”)? res.json(obj) : res.json(myobj);
});
:sunglasses: