Starting over - 'fullstackopen' section 3 with mongodb I got to section 5 and realized I did not understand WHY and broke my app beyond repair trying to figure it out.
😁YAY! It works now!
https://floating-bayou-03011.herokuapp.com/
Steps to deploy (Express) :
-
heroku login, heroku create
-
add
Procfile
to backend root, and addapp.use(express.static("build"))
toindex.js
-
create repo/commit to git without
build
directory -git push -u origin master
-
configure Heroku with mongodb url/password
heroku config:set MONGODB_URI=mongodb+srv://fullstack2020:YOUR-ACTUAL-PASSWORD@cluster0-lw40o.mongodb.net/example-app?retryWrites=true
NOTE: Don't forget to add SECRET=secret
to heroku config after adding jwt auth! That's what my problem was!
#HEROKU TROUBLESHOOTING: Lesson learned the hard way. Heroku does not update your .git/config for you if you delete and re-create your heroku app. If you run into problems, check the config file for an entry that looks like this:
[remote "heroku"]
url = https://git.heroku.com/floating-bayou-03011.git
fetch = +refs/heads/*:refs/remotes/heroku/*
Make sure the url is correct.