upload full-stack website with Heroku + mongodb + mLab
- knowledge: html, css (bootstrap), javascript, jquery and basics of node.js.
- installitions: node.js, GitHub desktop, git and code editor (VS Code / Sublime 3).
- sign up: Heroku + mLab.
- clone this repo.
- run "npm install" on the repo folder.
- initialize PORT.
- run "npm start" and check all working => (http://localhost:8080/)
- sign up to Heroku.
- create new app.
- connect to github repo.
- enable automatic deploy.
- initialize PORT.
- commit & push the code to GitHub -.then() check on Heroku app.
- sign up to mLab.
- create new DB. ('alerts')
- create new collection ('messages') with some documents ('{"id": 1, "msg": "Hello World", "counter": 0}').
- copy the MongoDB URI to 'index.js' file.
- add new user to the DB. (user: admin, password: myFirstWebinar1)
- modify the MongoDB - assign username + password.
- copy the MongoDB URI to 'Config Vars' in Heroku (MONGODB_URI : 'mongodb://admin:[email protected]:61112/alerts')
- use nodemon - run "nodemon index.js"
- example 0 - alert Hello + {name} .
- example 1 - simple connection to mongoDB.
- example 2 - get the count of documents and return random msg.
- example 3 - create new doc.
- example 4 - update counter.