I have followed the tutorial properly but this is what I got after the instructions
Your app is listening on port 3000
(node:2372) [DEP0170] DeprecationWarning: The URL mongodb://<user>:<password>@<database>-cluster-shard-00-00.jcsnu.mongodb.net:27017,<database>-cluster-shard-00-01.jcsnu.mongodb.net:27017,<database>-cluster-shard-00-02.jcsnu.mongodb.net:27017/?authSource=admin&replicaSet=atlas-96ixrx-shard-0&retryWrites=true&w=majority&ssl=true is invalid. Future versions of Node.js will throw an error.
(Use `node --trace-deprecation ...` to show where the warning was created)
I asked on chatgpt, and chatgpt suggested me to install mongoose@latest, after I installed the package.json mongoose dependency
changed from "mongoose": "^5.11.15"
to "mongoose": "^8.9.3"
And when I run it, I get a different error
(node:2794) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2794) [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
Your app is listening on port 3000
And I still can’t solve the problem
Then I changed
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true })
to
mongoose.connect(process.env.MONGO_URI)
and no error appeared
> fcc-mongo-mongoose-challenges@0.0.1 start
> node server.js
Your app is listening on port 3000
but still can’t
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36