- Write on your terminal
npm init -y
- Than install json server
npm i json-server
- Create
.gitignore
file, and add one line in that file/node_modules
- Create
server.js
file to set up server (Add some boilerplate code inserver.js
. It is always would be like this) - Create
db.json
file, and include your own data fromdb.json
in react app. - Push everything into github new repo.
- Create heroku account,
- Install heroku-cli. Examples here https://devcenter.heroku.com/articles/heroku-cli
And check
heroku --version
is it installed. - Next -->
heroku login
. It will open a tab in the browser. Confirm login. heroku create ...
in place of dots write the name of the project. (Name must start with a letter, end with a letter or digit and can only contain lowercase letters, digits, and dashes.)- Push your app to Heroku
git push heroku master
- Open your created app
heroku open
A pipeline is simply a connection between your GitHub repo and your Heroku Project. So, Whenever you update your db.json for example and push your changes to a specific branch Heroku will be listening to this branch and build your app with the updated database.
- Navigate to Deploy tap and create a pipeline, Connect your GitHub with the fake-server repo.
- Connect with github
- Configure auto-deploy and choose the branch of the Pipeline
Now whenever you push the changes to the selected branch, the database will be updated and can be accessed via the same base API.
- Install firebase tools
npm install -g firebase-tools
- Create build folder for deploying
npm run build
- Enter into your firebase account
firebase login
- Setup a firebase context for the current application
firebase init
- Press space to select the features, than enter to confirm your choice.
Select first Hoisting
- Go to the firebase console. And create new project or use an existing project (where you made an auth)
-
Select your project and press enter key.
-
Type
build
folder. Build is a compiled version of a program. -
Configure as a single app -->
yes
. -
Set up automatic builds and deploys with GitHub -->
no
. -
File build/index.html already exists. Overwrite? -->
no
. -
The last part
firebase deploy
.