Hello, best wishes and a Happy New Year community!
I’m currently working on the " Basic Node and Express - Use the .env File" exercise:
Store the variable MESSAGE_STYLE=uppercase in the .env file. Then tell the GET /json route handler that you created in the last challenge to transform the response object’s message to uppercase if process.env.MESSAGE_STYLE equals uppercase . The response object should become {"message": "HELLO JSON"} .
I’m having some issues getting the proper response in the browser, it displays “Not Found”. So I was wondering if that could be related to something wrong with my setup or something on Repl.
Hi @Danilo7 Welcome back to the freeCodeCamp forums—it’s been a while!
Here are a few tips:
Be sure that your .env file is in the root directory of your project. You should be seeing it listed next to the other dot-files (.replit, .gitignore) in the Files tree view in your repl.it project.
Be sure that inside your .env file that you have MESSAGE_STYLE=uppercase, as is, without quotes of any kind.
Be sure that you’re repl.it project is running with the latest code, use the Stop/Run button near the top of the window to ensure it is running the latest code when you try to test it out.
Be sure you’re that you’re using the correct route in the URL when you test manually (i.e. project.user.repl.co/json) in your browser. The last part of the url (/json) should match the route you configured via the app.get(...) call.
When you provide your repl.it project url to the freeCodeCamp test you should leave off the /json
Are you sure the repl is running when you try and run the freeCodeCamp test? Double check by trying your URL (with the /json) in your browser. If you get that response in your browser then it should pass that test.
Hi, I did all the suggestion above, and still didn’t work. As soon as I click the complete button on the task’s page, my repl.it suddenly stop running and it shows this message :
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
Tried many times and always get this result. Any help please?
Unfortunately, there seems to be a known issue with this lesson’s challenge at the moment. I recommend continuing on and check back on that linked issue to see when the problem is resolved.