This has been mentioned by other members as well but I’ve applied all the changes and still it’s not working.
Here are the errors that I’m facing:
- “mongoose” should be connected to a database
- “mongodb” dependency should be in package.json
- “mongoose” dependency should be in package.json
And here’s my code:
Env File:
MONGO_URI=mongodb://<username>:<password>@ds041377.mlab.com:41377/freecodecamp-1
The username and password have been replaced with my username and password (without “<” and “>”).
Second, there’s no special character in the password. Just alpha numeric.
I’ve checked the output of process.env.MONGO.URI and it’s generating the correct output so apparently my env configuration is all right.
Here’s my package.json file
{
"name": "fcc-learn-node-with-express",
"version": "0.1.0",
"dependencies": {
"express": "^4.14.0",
"body-parser": "^1.15.2",
"cookie-parser": "^1.4.3",
"fcc-express-bground": "https://github.com/Em-Ant/fcc-express-bground-pkg.git",
"mongodb": "^3.0.10",
"mongoose": "^5.1.6"
},
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"engines": {
"node": "4.4.5"
}
}
And here’s myApp.js file:
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI);
So guys, what am I missing? Everything seems to be perfectly fine but still it’s giving the above errors.
Would love to be offered a helping hand here.
Thank you.