Skip to content

Instantly share code, notes, and snippets.

@nurmdrafi
Last active May 6, 2022 07:31
Show Gist options
  • Save nurmdrafi/677da1421e131e8ba11155585a80aaee to your computer and use it in GitHub Desktop.
Save nurmdrafi/677da1421e131e8ba11155585a80aaee to your computer and use it in GitHub Desktop.
-----------------------------------------
⭐⭐⭐ONE TIME FOR YOUR COMPUTER⭐⭐⭐
-----------------------------------------
> create heroku account
> verify email
> install heroku cli
> heroku login
---------------------------------
⭐⭐⭐CHECK BEFORE DEPLOY⭐⭐⭐
---------------------------------
> open server folder from vscode
> check list
> index.js
> const port = process.env.PORT (we are hosting in a shared port)
> testing server from "root" "/"
app.get("/", (req, res) => {
res.send("running server")
})
> package.json
> "start" : "node index.js" (for run server in heroku)
> npm run start-dev // testing locally server is okay
----------------------------------------
⭐⭐⭐FOR EACH PROJECT ONE TIME⭐⭐⭐
----------------------------------------
> close local host [server]
> heroku create
> new app created with random name
> https://dashboard.heroku.com/apps
[OR]
> heroku create YOUR_PROJECT_NAME
> https://dashboard.heroku.com/apps
> make sure about git commands
> git add .
> git commit -m"comments"
> git push
> git push heroku main
> go to > dashboard > settings > reveal config vars
> copy paste config file from .env file
> make sure select network access all at mongodb
> check endpoints
> [Example]
> https://ebike-warehouse.herokuapp.com/inventory
> if shows data
> that means heroku connected with mongodb
------------------------------------
🎯⭐🎯UPDATE HEROKU SERVER🎯⭐🎯
------------------------------------
> make changes
> git add .
> git commit -m"comments"
> git push
> git push heroku main
----------------------------------------
⭐⭐⭐CONNECT HEROKU WITH CLIENT⭐⭐⭐
----------------------------------------
> replace http://localhost:5000/ with heroku url
-----------------------------
⭐⭐⭐FIREBASE DEPLOY⭐⭐⭐
-----------------------------
> go to firebase hosting
> npm install -g firebase-tools [ONE TIME FOR COMPUTER]
> firebase login [ONE TIME FOR COMPUTER]
> allow permision cli [y]
> firebase init [ONE TIME FOR EACH PROJECT]
> are you want to proceed? [y]
> (*) Hosting: Configures files for Firebase Hosting and (optionally set up Github Action Deploys)
> [Enter]
> Use an existing project
> [Enter]
> sellect project from list
> what do you want to use as your public directory> [build][Enter]
> Configure as a singpe-page app (rewrite all urls to /index.html) [y]
> Set up automatic builds and deploys with Github? [n]
> Firebase initialization complete! ✔
> npm run build [EVERYTIME FOR DEPLOY]
> firebase deploy [EVERYTIME FOR DEPLOY]
-----------------------------------
🎯⭐🎯UPDATE FIREBASE SERVER🎯⭐🎯
-----------------------------------
> make changes
> git add .
> git commit -m"comments"
> git push
> npm run build
> firebase deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment