Need help with env file challenge

hello I did the same thing with the code:

app.get("/json", (req, res) => {
  res.json( "message": process.env.MESSAGE_STYLE=="uppercase" ? "HELLO JSON": "Hello json"

but still i am notgetting the output

can you please help me

Hi @harshit29401 !

Welcome to the forum!

I created a new post for you and moved it out of that other conversation.

Whenever you have an issue with a challenge it is always best to include your full code not just snippets.

Please provide us with your replit link.

I would suggest rewriting this.

This should be the basic structure.

if message style is uppercase
  then the response is "message": "HELLO JSON" 
 the response is "message": "Hello json"

Or this if you want to use ternary.

  res.json(process.env.MESSAGE_STYLE=="uppercase" ? {"message": "HELLO JSON"}: {"message": "Hello json"})

Hope that helps!

i am getting the output in json

{“message”:“HELLO JSON”}

But in freecodecamp when i am entering the solution link then it shows

And this my replit project link :

It looks like you are editing the file now.

But have you tried the suggestion I gave you earlier?

 res.json(process.env.MESSAGE_STYLE=="uppercase" ? {"message": "HELLO JSON"}: {"message": "Hello json"})

yes i tried but same error

It should be working now.

I just used the process.env.MESSAGE_STYLE and that seemed to work.
I don’t know why it didn’t work with the my secret variable :woman_shrugging:

i tried in freecodecamp again but no luck same error is coming

It is working on my end. When I run the server and copy the link it passes for me.

what should i do to pass it?

I just logged back into your replit and it doesn’t look like your server is running.

When I start the server and then run it, then the test passes for me.

1 Like

ok thanks for the help

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