Step 13
Let's deploy the QuickNotes API to Heroku.
-
Head over to Heroku and create a new app. I called mine
quicknotes-api
. -
In the Settings, Add "nodejs" as a "buildpack."
-
Under "Deploy," select "GitHub" and connect the Heroku app to the GitHub repository of QuickNotes API. Make sure to enable automatic deployment.
-
Add a
Procfile
to the project!
web: node ./server/index.js
- Remove the MongoDB cluster URL before pushing to the repository! We don't want to push our database URI to a public repository!!
- // TODO replace <password> with the password for quicknote-admin
- const URI = `mongodb+srv://quicknote-admin:<password>@quicknote.ydsfc.mongodb.net/quickNoteDB?retryWrites=true&w=majority`;
+ const URI = process.env.DB_URI;
- Add the URI as an environment variable to the Heroku app.
- Push the changes to the GitHub repository.
Make sure the Heroku app is successfully deployed and functions as expected.