It seems on Replit.com it’s no longer to create a .env file. Instead they ask you to put you configure your environment in the left sidebar in what looks to be called the ‘Secrets section’.
With the .env file my app worked as expected on Replit.com. I’m having issues getting the app to run correctly with these new ‘secrets’, however.
My app connects to MongoDB, and the functional tests pass, I then get a message that my Repl cannot be reached.
It seems the introduction of ‘secrets’ has just occured in the last few days so I can’t find any documentation on FCC to refer to. For that reason I thought I’d make a post for both myself and anyone else that may be struggling with this issue.
In my server.js and fcctesting.js files I tried to replace instances of process.env.PORT, and process.env.DB with my new ‘secret’ variables like PORT and DB, but my app still isn’t working correctly.
I found the issue so I’m going to update this post just in case anyone else got stuck. It seems the boilerplate code includes the following line:
require("dotenv").config();
You need to remove this line as it attempts to load the environmental variables from a .env file (which we no longer have due to the introduction of REPLIT secrets). Hope someone finds this useful!
I apologize for the late reply (it’s been several weeks since I’ve logged into the forum). I’m pretty sure it’s in the server.js file, but it’s also possible they’ve updated the boilerplate code since my first post.