Stuck on challenge 6 on the free code camp backend course(node-express)

I’ve been stuck on this for over 24 hours… and I resulted to coming on here so I can give past this challenge. I’m using replete to solve these challenges and I guess that’s one of the reasons im still stuck. Here’s a picture:

HI @geekiedj !

Welcome to the forum!

In the secrets tab, you are using the wrong key and value.

The key is MESSAGE_STYLE and the value is uppercase

Hope that helps!

replit does not use a traditional env file because it uses the secrets tab.
So you can delete your .env file from your files directory

Can you fix your indentation so it is easier to read the code?
Right now it looks like you have an extra } but I am not sure because the code is not indented in a traditional way.

Thanks y’all… so I deleted the dot env file and corrected the key and value thing. but im still failing the test … here’s what I have now

Hi @jwilkins.oboe thank you so much. so I did all that you suggested and I still can’t move past the test…not sure what I’m doing wrong this time… I attached another picture of the current state.

Here’s the response for why I failed the test " // running tests The response of the endpoint

/json

should change according to the environment variable

MESSAGE_STYLE

// tests completed"

maybe try restarting the replit server at this time.

(also not sure why you removed the code to use app.use. I always assume that code from a previous step is to be kept unless expressly told to remove it. In this case the app.use line should be listed before the app.get)

okay… I just did. still the same. restarted. not sure what’s going on… thank you. very much appreciated

Can you post a link to your replit (put it in between angled brackets so it will display correctly here)

As said, it would be much better if you just posted the Replit.

You did actually save the secret right?

Add a return to the res.json() calls. The headers sent error is usually caused by having multiple reses (even though in this case I might expect the if/else to handle it).

Your code for app.get(‘/’) works for the task-in-hand, so I guess your .env variable hasn’t been saved (as suggested), or there’s a problem elsewhere. Otherwise, your code should pass.
Having said that, const mySecret = process.env[‘.env’] is incorrect code but also surplus to requirements (it just doesn’t prevent your code from passing). You could remove that line of code altogether. Also, using toUpperCase is redundant when you’re applying it to a string which is already uppercase.

Still, that code block works.

An alternative approach might be to declare the mySecret variable with the MESSAGE_STYLE environment variable, then use mySecret within the if/else statement. If you wanted to use toUpperCase, you could store ‘Hello json’ as a variable also and then apply toUpperCase within the res.json, as a condition of the value of mySecret.

< * server.js - boilerplate-express - Replit >

yes I did save it.
here’s the link to the replete.

< * server.js - boilerplate-express - Replit >

Hey Hey everyone so I passed the test even though it kept saying not found on replit. I erased the mySecrets variable I declared and somehow it worked… Thanks y’all. Appreciate