Hello, I am struggling to get this challenge to work. If anyone can review my code and point out any errors, I would appreciate it.
Problem: The tests fail with the messages:
“mongodb” dependency should be in package.json (Test timed out)
“mongoose” dependency should be in package.json (Test timed out)
“mongoose” should be connected to a database (Test timed out)
Code in myApp.js:
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });
Code in package.json:
{
"name": "fcc-mongo-mongoose-challenges",
"version": "0.0.1",
"description": "A boilerplate project",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.12.4",
"body-parser": "^1.15.2",
"mongodb": "^3.5.7",
"mongoose": "^5.9.12"
},
"engines": {
"node": "4.4.5"
},
"repository": {
"type": "git",
"url": "https://hyperdev.com/#!/project/welcome-project"
},
"keywords": [
"node",
"hyperdev",
"express"
],
"license": "MIT"
}
I have created an .env file with the following code (note password has been removed for the forum post but is correct in the actual .env without ‘<>’):
MONGO_URI='mongodb+srv://kapigeau:<password>@cluster0-dircc.gcp.mongodb.net/test?retryWrites=true&w=majority'
Thank you!
Edit: I was able to create and setup the database with no problems.
Link to the challenge: