Node challenges Json response

**Tell us what’s happening:

Hello everyone!
In this challenge, the browser seems to return the object correctly as proposed, but checking from freeCodeCamp does not allow me to proceed. Is there an error in the code?

Your code so far

var express = require(‘express’);
var app = express();
console.log(‘Hello World’);

app.get("/", function(req, res) {
res.sendFile(__dirname + “/views/index.html”);
});

app.use("/public", express.static(__dirname + “/public”));

app.get("/json", (req, res) => {
if ( process.env.MESSAGE_STYLE === “uppercase”) {
res.json({
message: “HELLO JSON”
})
} else {
res.json({
message: “Hello Json”
})
}

});

Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

Ok, thanks a lot! :pray::pray::pray:

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