Basic Node and Express - Use the .env File

Tell us what’s happening:

I am unable to solve this challenge I am correctly writing the code without any syntax error as well

my code
‘’’ app.get(“/json”,function(req, res){
if (process.env.MESSAGE_STYLE === “uppercase”) {
res.json,({“message”: “HELLO JSON”})
} else {
res.json,({“message”: “Hello json”})
}

})‘’’

Please explain how to do this.

###Your project link(s)

solution: https://e1777f23-350c-48e2-976f-38b4b12114b2-00-1t4o8ocsy95js.sisko.replit.dev

Your browser information:

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

Challenge Information:

Basic Node and Express - Use the .env File

When I did this challenge, I didn’t use quotations around message. Maybe that is the issue.

the comma after json is not correct syntax

1 Like

@PictoDEV Alright, first of all

In your project’s .env file, add this.

code removed by moderator

And then secondly , in your myApp.js or main app file write

code removed by moderator

hi @abdulahadbeast1995

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like