I’m stuck in Mongo - Data Validation chapter, lesson 7: Add Persistence to Genres API
I made all the refactoring to persist the genres in Mongo DB, however, the vidly database is not created even though:
a) mongod is running in the background
b) the connection to the db is successful (I wrapped up the code in a try/catch and no errors are reported):
try {
mongoose.connect(url, dbConfig)
.then(() => console.log(‘Connected to MongoDB Vidly…’))
}
catch (err) {
console.log(‘Error’, err.message);
}
c) I tried so many times to reproduce what you show as a successful Post through Postman, but it fails, every single time with the following error shown:
Status: 404 Not Found
Cannot POST /api/videos