I need a help ,on new replit. env file

Tell us what’s happening:
I will like to know how to use the new style of replit on .env file .
which one is the key and which is value.
please use this example to show


am actually on mongodb and mongoose,challenge that is API and micro services.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Android 8.1.0; Mobile; rv:85.0) Gecko/85.0 Firefox/85.0.

Challenge: Install and Set Up Mongoose

Link to the challenge:

Hi @route-chris !



will you mind going through my link to see if I failed to put the key and the value very well? Cause I did the needful.
error message: connect mongoose to mongodb. Which I did,

I am not able to see your keys because they are supposed to be secret.
Only you can see them.

1 Like

I try to copy the whole env environment.


System environment variables







add new secret

Use secrets in the repl

To use secrets in Node.js

Access the secret by key as an environment variable


const mySecret = process.env[‘MONGO_URI’]

insert →

Environment Variables

not really well arrange cause it is copy, but I hope you can understand it.

From what I can tell, where you placed the key and values looks right.

But the structure of my uri looks different from yours.
Mine looks a little bit longer and has my username and password in it.
Mine also ends with this ‘retryWrites=true&w=majority’

Did you truncate your uri so you wouldn’t put your username and password out there on the forum?
It makes sense if you don’t want to put your personal info out there.

But if not, maybe the value is the problem.

I am definitely not an expert in this stuff so someone else my have another solution but I would double check to make sure that what you are putting into the value matches with your MongoDB Atlas database URI.

1 Like

I guess that should be the error. Let me-correct an try again.

Also, try it without the quotes for the value.
I just redid mine with this new replit setup and removed the quotes for the value and it worked for me.

Also, make sure you did this last part.

mongoose.connect(mySecret, { useNewUrlParser: true, useUnifiedTopology: true });

1 Like

take at one look and say to your opinion if am okay:


Lastly myApp set up:

const mongoose = require(‘mongoose’);
mongoose.connect(process.env.MONGO_URI,{useNewUrlParser: true, useUnifiedTopology: true});

As long as your actual uri has your password and username it should be correct. I would just copy it straight from the mongo account and make sure your password is in there like the article said.

For the mongo.connect part I would just copy what fcc gave you and for the uri in the beginning you can just use the mySecret variable since it is already in your code

1 Like

Hi, am confuse here.

// Handle returning a timestamp
app.get('/api/timestamp/:date?', (req, res) => {
    // Store our date response. This will default to the current datetime
    let date = new Date();

from the example above, inside get HTTP the part is it the directory where date are been store on the server or is suppose to be your own part where your serving time on the server?
I mean ‘/api/timestamp/:date?’,
inside HTTP get()

Is this a new challenge?

If so, it would be best to create a new topic using the ask for help button.
That way we have all of the information needed to assist you.


Its not a challenge though, its just a little confusion an I have pass the stage. Just wanted to have the understanding. But I guess I should open up new topic. Thanks

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