# Basic Node and Express - Use the .env File - Not Found issue

**URL:** <https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [January 4, 2021, 4:30pm UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830 "2021-01-04T16:30:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danilo7](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/danilo7/32/379506_2.png) [@Danilo7](https://forum.freecodecamp.org/u/Danilo7)\
**Post date:** [January 4, 2021, 4:30pm UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830/1 "2021-01-04T16:30:18Z")

</div>

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.

**Here’s my code**

```auto
app.get("/json", (req, res) => {
  let hello = {message: "Hello Json"};
  if(process.env.MESSAGE_STYLE === "uppercase"){
    hello.message = hello.message.toUpperCase();
  }
  res.json(hello);
});

```

I 've created the .env file with the variable “MESSAGE\_STYLE=uppercase” inside too.

I’m kind of new with JS, so I’d be really grateful if you could provide some guidance on how to properly search issues for Node JS.

Thanks in advance for the help and patience.

**Your browser information:**

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

**Challenge:** Use the .env File

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/back-end-development-and-apis/basic-node-and-express/use-the--env-file)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![robertgroves](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/robertgroves/32/209852_2.png) [@robertgroves](https://forum.freecodecamp.org/u/robertgroves)\
**Post date:** [January 4, 2021, 5:00pm UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830/2 "2021-01-04T17:00:06Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![Danilo7](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/danilo7/32/379506_2.png) [@Danilo7](https://forum.freecodecamp.org/u/Danilo7)\
**Post date:** [January 5, 2021, 5:11pm UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830/3 "2021-01-05T17:11:23Z")

</div>

Hi @robertgroves! it’s nice to be back learning again!

Thanks for those tips. Actually, you were right It was missing the “/json” part from the path.

Now pointing the right direction I’m getting:

> {“message”:“HELLO JSON”}

As a response, which is the right answer. However, I provided the proper path to the freeCodeCamp test (without “/json”) and it’s not working yet.

The .env file is among the other dot.files and it contains only MESSAGE\_STYLE=uppercase. So that seems to be right too.

I’ll keep cheking the code to see if I can spot something missing.

Really thankful for your assistance!

---

<div class="post-metadata">

**Author:** ![robertgroves](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/robertgroves/32/209852_2.png) [@robertgroves](https://forum.freecodecamp.org/u/robertgroves)\
**Post date:** [January 5, 2021, 8:20pm UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830/4 "2021-01-05T20:20:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mluthfi94](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mluthfi94/32/183759_2.png) [@mluthfi94](https://forum.freecodecamp.org/u/mluthfi94)\
**Post date:** [February 10, 2021, 5:31am UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830/5 "2021-02-10T05:31:16Z")

</div>

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?

Here’s my code anyway 🙂 [https://repl.it/@mluthfi94/boilerplate-express](https://repl.it/@mluthfi94/boilerplate-express)

Thanks

---

<div class="post-metadata">

**Author:** ![robertgroves](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/robertgroves/32/209852_2.png) [@robertgroves](https://forum.freecodecamp.org/u/robertgroves)\
**Post date:** [February 10, 2021, 3:33pm UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830/6 "2021-02-10T15:33:49Z")

</div>

Hi @mluthfi94👋 Welcome to the freeCodeCamp forums! 🎉

Unfortunately, there seems to be a known [issue with this lesson’s challenge](https://github.com/freeCodeCamp/freeCodeCamp/issues/40915) at the moment. I recommend continuing on and check back on that linked issue to see when the problem is resolved.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [August 12, 2021, 3:33am UTC](https://forum.freecodecamp.org/t/basic-node-and-express-use-the-env-file-not-found-issue/438830/7 "2021-08-12T03:33:54Z")

</div>

Closed on August 12, 2021, 3:33am UTC

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