Skip to content

Begimai02/deploy_json-server-heroku_react-firebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fake_server_heroku_bg

How to deploy your fake json-server on heroku?

First part, prerequisite

  1. Write on your terminal npm init -y
  2. Than install json server npm i json-server
  3. Create .gitignore file, and add one line in that file /node_modules
  4. Create server.js file to set up server (Add some boilerplate code in server.js. It is always would be like this)
  5. Create db.json file, and include your own data from db.json in react app.
  6. Push everything into github new repo.

Second part, heroku

  1. Create heroku account,
  2. Install heroku-cli. Examples here https://devcenter.heroku.com/articles/heroku-cli And check heroku --version is it installed.
  3. Next --> heroku login. It will open a tab in the browser. Confirm login.
  4. 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.)
  5. Push your app to Heroku git push heroku master
  6. Open your created app heroku open

Creating a Pipeline

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.

  1. Navigate to Deploy tap and create a pipeline, Connect your GitHub with the fake-server repo.

Снимок экрана 2022-04-14 в 19 27 13

  1. Connect with github

Снимок экрана 2022-04-14 в 19 30 06

  1. Configure auto-deploy and choose the branch of the Pipeline

Снимок экрана 2022-04-14 в 19 28 01

Now whenever you push the changes to the selected branch, the database will be updated and can be accessed via the same base API.


How to deploy your front on firebase?

  1. Install firebase tools npm install -g firebase-tools
  2. Create build folder for deploying npm run build
  3. Enter into your firebase accountfirebase login
  4. Setup a firebase context for the current application firebase init
  5. Press space to select the features, than enter to confirm your choice.

Select first Hoisting

Снимок экрана 2021-11-30 в 16 08 27

  1. Go to the firebase console. And create new project or use an existing project (where you made an auth)

Снимок экрана 2021-11-30 в 16 08 27

  1. Select your project and press enter key.

  2. Type build folder. Build is a compiled version of a program.

  3. Configure as a single app --> yes.

  4. Set up automatic builds and deploys with GitHub --> no.

  5. File build/index.html already exists. Overwrite? --> no.

  6. The last part firebase deploy.

Снимок экрана 2022-04-14 в 21 07 16

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published