<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nikita Guliaev🧩</title>
    <description>The latest articles on Forem by Nikita Guliaev🧩 (@nikita_guliaev).</description>
    <link>https://forem.com/nikita_guliaev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F454917%2Fd93db836-bf34-4a88-a9cb-6368833cd57d.jpg</url>
      <title>Forem: Nikita Guliaev🧩</title>
      <link>https://forem.com/nikita_guliaev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nikita_guliaev"/>
    <language>en</language>
    <item>
      <title>Deploying Create-React-App with Json-Server as backend to Github
</title>
      <dc:creator>Nikita Guliaev🧩</dc:creator>
      <pubDate>Tue, 18 Aug 2020 19:58:25 +0000</pubDate>
      <link>https://forem.com/nikita_guliaev/deploying-create-react-app-with-json-server-as-backend-to-github-3pp9</link>
      <guid>https://forem.com/nikita_guliaev/deploying-create-react-app-with-json-server-as-backend-to-github-3pp9</guid>
      <description>&lt;p&gt;If you are reading this article I’m assuming you already have the following done:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a project using Create-React-App;&lt;/li&gt;
&lt;li&gt;You are using Json-Server &amp;amp; have a &lt;code&gt;db.json&lt;/code&gt; file that you are using as a fake REST API for quick prototyping;&lt;/li&gt;
&lt;li&gt;Your application is working in your local environment;&lt;/li&gt;
&lt;li&gt;Your app has a repo on GitHub&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you want to deploy your app to GitHub so you could share the link with someone. Here is a step by step process to do that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; &lt;br&gt;
Got to &lt;a href="https://my-json-server.typicode.com/" rel="noopener noreferrer"&gt;Json-Server page&lt;/a&gt; and follow the instructions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a separate repo on GitHub;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upload your &lt;code&gt;db.json&lt;/code&gt; file there;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;code&gt;https://my-json-server.typicode.com/&amp;lt;your-github-username&amp;gt;/&amp;lt;your-repo-name&amp;gt;&lt;/code&gt; to access your server.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;br&gt;
Deploy your application to GitHub following the usual process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a “Homepage” property to your package.json file: e.g. &lt;code&gt;http://&amp;lt;github-username&amp;gt;.github.io/&amp;lt;repo-name&amp;gt;&lt;/code&gt; so it it looks like that:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx2c826hixwveaevj2w7b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx2c826hixwveaevj2w7b.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add to your existing “Scripts” property 2 new properties - &lt;code&gt;predeploy&lt;/code&gt; &amp;amp; &lt;code&gt;deploy&lt;/code&gt;:
```
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;"scripts": {&lt;br&gt;
  "predeploy": "npm run build",&lt;br&gt;
  "deploy": "gh-pages -d build"&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;As shown down below:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xlau4nanlugn6x4v4hfs.png)


* Run the following commands in your terminal subsequently:
1. `npm run build`
2. `npm run deploy`

Almost done. Keep in mind that it may take a moment for Github to upload and build your app.


**Step 3:**
Go to your app’s repo and open Settings. In the GitHub Pages section select gh-pages branch from the drop-down menu. Hit save. If you see the following that means that everything is good &amp;amp; your app is being built. It usually takes up to 20-30 mins to see your app live on gihub pages.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kzrtrwf4d6141xdizrij.png)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>deploy</category>
      <category>github</category>
      <category>jsonserver</category>
      <category>createreactapp</category>
    </item>
  </channel>
</rss>
