*If you aren't sure what the above does, when you run your server on your computer, process.env.MONGODB_URI || "mongodb://localhost/mongo-scraper" will essentially be the same as undefined || "mongodb://localhost/mongo-scraper" which will resolve to "mongodb://localhost/mongo-scraper". But when you run your server on Heroku and you set up MongoDB on Heroku, process.env.MONGODB_URI || "mongodb://localhost/mongo-scraper" will resolve to process.env.MONGODB_URI.
I would strongly encourage you to get into the habit of handling your errors whenever you make an HTTP request or a query to your database. This will help prevent your code from breaking, your server from crashing, and if the error message is well written, it will also help you quickly debug the error.
Great job on the assignment, You were so close to completing the assignment.
https://github.com/chochoe/news-scraper/blob/1d8f38f70484801943db23c53679c9593b9df385/config/config.js#L9 Make sure to have the localhost URI so that you can connect to MongoDB on your computer for development. You can do this by doing something like
var MONGODB_URI = process.env.MONGODB_URI || "mongodb://localhost/mongo-scraper";
*If you aren't sure what the above does, when you run your server on your computer,
process.env.MONGODB_URI || "mongodb://localhost/mongo-scraper"
will essentially be the same asundefined || "mongodb://localhost/mongo-scraper"
which will resolve to"mongodb://localhost/mongo-scraper"
. But when you run your server on Heroku and you set up MongoDB on Heroku,process.env.MONGODB_URI || "mongodb://localhost/mongo-scraper"
will resolve toprocess.env.MONGODB_URI
.https://github.com/chochoe/news-scraper/blob/1d8f38f70484801943db23c53679c9593b9df385/routes/routes.js#L37 Just uncomment this as you need a page refresh to have the server render and serve the new handlebars page with the newly scraped articles.