{"id":412857,"date":"2024-06-29T22:47:24","date_gmt":"2024-06-29T22:47:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=412857"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=412857","title":{"rendered":"<span>Github pages \u0434\u043b\u044f pet \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0433\u0430\u0439\u0434 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c github pages \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 fullstack pet \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c \u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445)<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0432\u043e\u0434\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0451\u043d \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442 \u0438\u0437 \u0432\u0435\u0442\u043a\u0438 <strong>main<\/strong> \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\" rel=\"noopener noreferrer nofollow\">gh-pages-demo<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c unix \u043a\u043e\u043c\u0430\u043d\u0434 <strong>mkdir<\/strong>, <strong>cd<\/strong>, <strong>touch<\/strong>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043b\u0435\u0433\u043a\u043e \u0433\u0443\u0433\u043b\u044f\u0442\u0441\u044f. \u0414\u043b\u044f \u043b\u0435\u043d\u0438\u0432\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c <a href=\"https:\/\/sites.tufts.edu\/cbi\/files\/2013\/01\/linux_cheat_sheet.pdf\" rel=\"noopener noreferrer nofollow\">linux cheat sheet<\/a><\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0433\u0438\u0442\u043e\u043c \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u041d\u043e \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0433\u043e GUI.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043b\u0430\u043d<\/h3>\n<p>\u041f\u043b\u0430\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c &#171;backend&#187;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c frontend<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c production \u0440\u0435\u0436\u0438\u043c<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0435\u043f\u043b\u043e\u0439 \u043d\u0430 github pages<\/p>\n<\/li>\n<li>\n<p>\u0411\u043e\u043d\u0443\u0441<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h3>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0437\u0430\u0441\u0435\u0442\u0430\u043f\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u044c github<\/h4>\n<p>\u0411\u0435\u0440\u0451\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0438\u043b\u0438 \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 <a href=\"https:\/\/github.com\/signup\" rel=\"noopener noreferrer nofollow\">github.com\/signup<\/a>.<br \/> \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<br \/> \u042f \u0437\u0430\u0432\u0435\u0434\u0443 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <strong>gh-pages-demo<\/strong><\/p>\n<h4>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:<\/h4>\n<pre><code class=\"bash\">- cd Documents\/projects - git clone git@github.com:robzarel\/gh-pages-demo.git <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e ssh, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 http \u0438\u043b\u0438 zip \u0430\u0440\u0445\u0438\u0432\u043e\u043c.<\/p>\n<h4>\u0421\u0435\u0442\u0430\u043f\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h4>\n<p>C\u0435\u0442\u0430\u043f\u0438\u043c <strong>typescript<\/strong> \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/create-react-app.dev\/docs\/adding-typescript\/\" rel=\"noopener noreferrer nofollow\">react-create-app<\/a><\/p>\n<pre><code class=\"bash\">- cd gh-pages-demo - npx create-react-app . --template typescript <\/code><\/pre>\n<p>PS:<br \/> <strong>npx<\/strong> \u044d\u0442\u043e runner \u0434\u043b\u044f npm \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u041e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438\u0445, \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e <a href=\"https:\/\/www.npmjs.com\/package\/npx\" rel=\"noopener noreferrer nofollow\">npx<\/a> \u0438 <a href=\"https:\/\/www.codingninjas.com\/codestudio\/library\/difference-between-npm-and-npx\" rel=\"noopener noreferrer nofollow\">npm vs npx<\/a><\/p>\n<h4>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c<\/h4>\n<pre><code class=\"bash\">- git add . - git commit -m \"feat: initial commit\" - git push <\/code><\/pre>\n<h4>\u041a\u043e\u0434:<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/49de62e0a76e19820c1ee4bf9c5d973244ff8ff0\" rel=\"noopener noreferrer nofollow\">feat: initial commit<\/a><\/p>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c &#171;backend&#187;<\/h3>\n<p>&#171;backend&#187; \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/typicode\/json-server\" rel=\"noopener noreferrer nofollow\">json-server<\/a>.<br \/> &#171;backend&#187; \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043a\u043e\u0432\u044b\u0447\u043a\u0430\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0438\u043c\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0431\u044d\u043a\u0430, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0444\u0430\u0439\u043b\u0430\u0445)<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c json-server<\/h4>\n<pre><code class=\"bash\">  npm install --save-dev json-server <\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e<\/h4>\n<p>\u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 &#171;\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435&#187; \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<pre><code class=\"bash\">- cd src - mkdir server - cd server <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 api<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c json-server \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u0430\u043f\u0438 \u0431\u044b\u043b\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c <strong>api<\/strong><\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b <strong>routes.json<\/strong><\/p>\n<pre><code class=\"bash\">- touch routes.json <\/code><\/pre>\n<p>\u041d\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code class=\"json\">{ \"\/api\/*\": \"\/$1\" } <\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u0432 json-server: <a href=\"https:\/\/github.com\/typicode\/json-server#add-custom-routes\" rel=\"noopener noreferrer nofollow\">add-custom-routes<\/a><\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b json-server \u043c\u043e\u0433 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"bash\">- mkdir db - cd db - touch data.json - touch index.js <\/code><\/pre>\n<h3>index.js<\/h3>\n<p>\u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0438\u0442\u044c json-server:<\/p>\n<pre><code class=\"javascript\">const data = require('.\/data.json');  module.exports = () => ({   data: data, }); <\/code><\/pre>\n<h3>data.json<\/h3>\n<p>\u0421\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 index.js:<\/p>\n<pre><code class=\"json\">{ \"greeting\": \"Hello world\" } <\/code><\/pre>\n<p>PS:<br \/> \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 <strong>module.exports<\/strong> \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 <strong>\u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442. \u042d\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 api \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0444\u0440\u043e\u043d\u0442\u0430.<\/p>\n<h4>\u041f\u0438\u0448\u0435\u043c npm scripts<\/h4>\n<p>\u0412 \u0441\u0435\u043a\u0446\u0438\u0438 scripts \u043d\u0430\u0448\u0435\u0433\u043e package.json \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u043a\u0440\u0438\u043f\u0442 <strong>serve<\/strong> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u0448\u0435\u0433\u043e <strong>json-server<\/strong>:<\/p>\n<pre><code class=\"bash\">    \"serve\": \"json-server --watch .\/src\/server\/db\/index.js --routes .\/src\/server\/routes.json --port 3001\", <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0438\u043c \u043d\u0430\u0448 json-server \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d<\/p>\n<ul>\n<li>\n<p>\u0431\u0440\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e <strong>index.js<\/strong>,<\/p>\n<\/li>\n<li>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0440\u043e\u0443\u0442\u044b \u0438\u0437 <strong>routes.json<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u043e\u0440\u0442 3001<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<pre><code class=\"bash\">  npm run serve <\/code><\/pre>\n<p>\u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:3001\/api\/data\" rel=\"noopener noreferrer nofollow\"><strong>http:\/\/localhost:3001\/api\/data<\/strong><\/a> \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0430\u0448\u0435\u0433\u043e json \u0444\u0430\u0439\u043b\u0438\u043a\u0430. \u041a\u0440\u0430\u0441\u043e\u0442\u0430.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0444\u0440\u043e\u043d\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/5d4cc2234e7af7d64b48d5c298251d04b4b612aa\" rel=\"noopener noreferrer nofollow\">feat: add json-server<\/a><\/p>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c frontend<\/h3>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0444\u0440\u043e\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0430\u0448 \u0441\u0432\u0435\u0436\u0435\u043d\u044c\u043a\u0438\u0439 \u0431\u044d\u043a\u0435\u043d\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <strong>Hello World<\/strong><\/p>\n<h4>API \u043c\u043e\u0434\u0443\u043b\u044c<\/h4>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0430\u0448\u0438\u043c \u0441\u0432\u0435\u0436\u0438\u043c api \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u044d\u043a\u043e\u043c.<\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0444\u0435\u0442\u0447\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430 json \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u043d\u0430\u0448 \u0431\u044d\u043a, \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0438\u0445 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c json \u0432 \u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<pre><code class=\"typescript\">import getEndpoints from '..\/server\/db';  const endpoints = getEndpoints();  type ENDPOINTS = keyof typeof endpoints; type RESPONSE_DATA = {   greeting: string; };  const getJson = async &lt;T>(endpoint: ENDPOINTS): Promise&lt;T> => {   const path = `http:\/\/localhost:3001\/api\/${endpoint}`;   const response = await fetch(path);    return await response.json(); };  type API = {   get: {     data: () => Promise&lt;RESPONSE_DATA>;   }; }; const api: API = {   get: {     data: () => getJson&lt;RESPONSE_DATA>('data'),   }, };  export type { RESPONSE_DATA, ENDPOINTS }; export default api; <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0432 <strong>module.exports<\/strong> \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u044d\u043d\u0434\u043f\u043e\u0439\u043d\u0442\u0430\u043c. \u0414\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0443\u0442\u0451\u043c \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0444\u0435\u0442\u0447\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <strong>keyof typeof<\/strong>)<br \/> \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432 <strong>ENDPOINTS<\/strong> <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/unions-and-intersections.html\" rel=\"noopener noreferrer nofollow\">union type<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0440\u0443\u0447\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e &#171;\u0431\u044d\u043a\u0435\u043d\u0434\u0430&#187;. \u0418 typescript \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0440\u0443\u0447\u043a\u0435 (\u043a\u0430\u043a\u0443\u044e \u0431\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 module.exports \u043c\u044b \u0431\u044b \u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438).<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e <a href=\"https:\/\/stackoverflow.com\/a\/62764510\/21579892\" rel=\"noopener noreferrer nofollow\">keyof typeof<\/a>.<\/p>\n<p>PS:<br \/> \u041f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0443\u0447\u0435\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0440\u0430\u0437\u043d\u043e\u0441\u0438\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0440\u0443\u0447\u0435\u043a \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c, \u0430 index.ts \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c.<\/p>\n<h4>\u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<p>\u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0445\u0443\u043a\u0430 <a href=\"https:\/\/react.dev\/reference\/react\/useEffect\" rel=\"noopener noreferrer nofollow\"><strong>useEffect<\/strong><\/a><br \/> \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0435\u0439\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/react.dev\/reference\/react\/useState\" rel=\"noopener noreferrer nofollow\">useState<\/a><\/p>\n<pre><code class=\"typescript\">import React, { useEffect, useState } from 'react';  import api from '.\/api'; import type { RESPONSE_DATA } from '.\/api';  import '.\/App.css';  function App() {   const [data, setData] = useState&lt;RESPONSE_DATA>();    useEffect(() => {     const fetchData = async () => {       const response = await api.get.data();       setData(response);     };      fetchData();   }, []);    return &lt;div className='App'>{data ? &lt;p>{data.greeting}&lt;\/p> : 'no data'}&lt;\/div>; }  export default App; <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432 2\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u0445 \u043a\u043e\u043c\u0430\u043d\u0434<\/p>\n<pre><code class=\"bash\">npm run serve <\/code><\/pre>\n<p>\u0438<\/p>\n<pre><code class=\"bash\">npm start <\/code><\/pre>\n<p>\u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:3000\" rel=\"noopener noreferrer nofollow\"><strong>http:\/\/localhost:3000<\/strong><\/a> \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 <a href=\"http:\/\/localhost:3001\/api\/data\" rel=\"noopener noreferrer nofollow\"><strong>http:\/\/localhost:3001\/api\/data<\/strong><\/a> \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/65788cff3e70a8f812238a83a9bf3539c42f94cc\" rel=\"noopener noreferrer nofollow\">feat: render api data<\/a><\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c production \u0440\u0435\u0436\u0438\u043c<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 2 \u0432\u043e\u043f\u0440\u043e\u0441\u0430:<\/p>\n<ul>\n<li>\n<p>\u0433\u0434\u0435 \u043d\u0430\u043c \u0445\u043e\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u043a\u043b\u0430\u0434\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u0445\u043e\u0441\u0442<\/p>\n<\/li>\n<\/ul>\n<h4>Hosting &#171;\u0441\u0435\u0440\u0432\u0435\u0440\u0430&#187;<\/h4>\n<p>Github \u0448\u0442\u0443\u043a\u0430 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0430\u044f \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0430\u043f\u0438, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0430\u043c.<\/p>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0448\u0438 \u0444\u0430\u0439\u043b\u044b \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 \u0434\u043e\u043c\u0435\u043d\u0435 <a href=\"https:\/\/raw.githubusercontent.com\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/raw.githubusercontent.com<\/strong><\/a><br \/> \u0410 \u043f\u0443\u0442\u044c \u043a \u043d\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<br \/> <a href=\"https:\/\/raw.githubusercontent.com\/userName\/projectName\/branchName\/relative-directory-path\/fileName\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/raw.githubusercontent.com\/userName\/projectName\/branchName\/relative-directory-path\/fileName<\/strong><\/a>, \u0433\u0434\u0435:<\/p>\n<ul>\n<li>\n<p><strong>userName<\/strong> &#8212; \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 gitHub<\/p>\n<\/li>\n<li>\n<p><strong>branchName<\/strong> &#8212; \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0442\u043a\u0438 \u0432 git<\/p>\n<\/li>\n<li>\n<p><strong>relative<\/strong>-directory-path &#8212; \u043f\u0443\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0434\u043e \u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><strong>fileName<\/strong> &#8212; \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 data.json)<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u0432 \u043d\u0430\u0448\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e backend \u044d\u043d\u0434\u043f\u043e\u0439\u043d\u0442\u043e\u0432. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043d\u0438\u043c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0442\u043a\u0443 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c gh-pages (\u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u0435).<br \/> \u0418 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a-\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0431\u043e\u0440\u043a\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <strong>static\/db<\/strong>.<br \/> \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u0439\u043b <strong>data.json<\/strong> \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443:<\/p>\n<p><a href=\"https:\/\/raw.githubusercontent.com\/robzarel\/gh-pages-demo\/gh-pages\/static\/db\/data.json\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/raw.githubusercontent.com\/robzarel\/gh-pages-demo\/gh-pages\/static\/db\/data.json<\/strong><\/a><\/p>\n<h4>\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0430 Fronetnd<\/h4>\n<h3>API \u043c\u043e\u0434\u0443\u043b\u044c<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 &#8212; <strong>development<\/strong> \u0438 <strong>production<\/strong><\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f NODE_ENV (\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 CRA \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <strong>process.env.NODE_ENV<\/strong>) \u0438 \u0441 \u0435\u0451 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c API \u043c\u043e\u0434\u0443\u043b\u044c. \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u043a\u0438 &#8212; \u0432 development \u0440\u0435\u0436\u0438\u043c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u043d\u0430\u0448 json-server, \u0430 \u0432 production \u0440\u0435\u0436\u0438\u043c\u0435 &#8212; \u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 <a href=\"http:\/\/raw.githubusercontent.com\" rel=\"noopener noreferrer nofollow\">raw.githubusercontent.com<\/a>.<br \/> \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>getJson<\/strong>:<\/p>\n<pre><code class=\"typescript\">const getJson = async &lt;T>(endpoint: ENDPOINTS): Promise&lt;T> => {   const path =     process.env.NODE_ENV === 'development'       ? `http:\/\/localhost:3001\/api\/${endpoint}`       : `https:\/\/raw.githubusercontent.com\/robzarel\/gh-pages-demo\/gh-pages\/static\/db\/${endpoint}.json`;    const response = await fetch(path);    return await response.json(); }; <\/code><\/pre>\n<h3>\u0412\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u043a\u0438 \u0432 \u0431\u0438\u043b\u0434<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0438 \u0444\u0430\u0439\u043b\u044b \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043f\u0440\u043e\u0434\u043e\u0432\u0443\u044e \u0441\u0431\u043e\u0440\u043a\u0443, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u0442\u0443\u0434\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/bpedro\/node-fs\" rel=\"noopener noreferrer nofollow\">node-fs<\/a> \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0444\u0430\u0439\u043b\u044b \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 build \u043f\u043e \u043d\u0443\u0436\u043d\u043e\u043c\u0443 &#171;\u0430\u0434\u0440\u0435\u0441\u0443&#187;.<\/p>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c node-fs<\/strong><\/p>\n<pre><code class=\"bash\">  npm install --save-dev node-fs <\/code><\/pre>\n<p><strong>\u041f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u0437\u043e\u0432\u0451\u043c save-json-api.js \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 src\/server\/scripts<\/p>\n<pre><code class=\"bash\">  cd src\/server   mkdir scripts   cd scripts   touch save-json-api.js <\/code><\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0431\u0443\u0434\u0435\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <strong>static\/db<\/strong>:<\/p>\n<pre><code class=\"javascript\">const fs = require('node-fs'); const getDb = require('..\/db');  const db = getDb();  fs.mkdir('.\/build\/static\/db', () => {   for (let [key, value] of Object.entries(db)) {     fs.writeFile(       `.\/build\/static\/db\/${key}.json`,       JSON.stringify(value),       (err) => {         if (err) throw err;       }     );   } }); <\/code><\/pre>\n<p>\u0418 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 npm script \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">    \"save-json-api\": \"node .\/src\/scripts\/save-json-api.js\",     \"build\": \"react-scripts build &amp;&amp; npm run save-json-api\", <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 npm run build \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e <strong>src\/server\/db\/index.js<\/strong>.<\/p>\n<p>PS:<br \/> \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u044b \u0432 module.exports \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0430 \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442, \u043c\u044b \u0434\u043e\u0431\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u0440\u043e\u0434\u0435.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u043e\u0432\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438)) \u042d\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 &#8212; \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c. \u0410 \u0432 \u043f\u0440\u043e\u0434 \u0443\u0435\u0437\u0436\u0430\u0442\u044c \u0443\u0436\u0435 \u0441\u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e &#171;\u044d\u043d\u0434\u043f\u043e\u0439\u043d\u0442\u0430&#187;<\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/b4e0e1c6e6735f70fb82dd68efcdde11b76041d2\" rel=\"noopener noreferrer nofollow\">feat: add production mode<\/a><\/p>\n<h3>5 \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0435\u043f\u043b\u043e\u0439 \u043d\u0430 github pages<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 github Pages \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c 2 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0432\u0435\u0436\u0443\u044e \u0441\u0431\u043e\u0440\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0432\u0435\u0442\u043a\u0443 gh-pages \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Github Pages<\/p>\n<\/li>\n<\/ol>\n<h4>\u041f\u0430\u043a\u0435\u0442 gh-pages<\/h4>\n<p>\u0414\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/www.npmjs.com\/package\/gh-pages\" rel=\"noopener noreferrer nofollow\">gh-pages<\/a>.<br \/> \u041f\u0430\u043a\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0437\u0430 \u043d\u0430\u0441 \u0441\u0431\u043e\u0440\u043a\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0431\u0438\u043b\u0434\u0430 \u0432 \u0432\u0435\u0442\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c gh-pages.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 gh-pages<\/h3>\n<pre><code class=\"bash\">  npm install --save-dev gh-pages <\/code><\/pre>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 npm scripts<\/h3>\n<p>\u0412 \u0441\u0435\u043a\u0446\u0438\u0438 scripts \u043d\u0430\u0448\u0435\u0433\u043e package.json \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u044b <strong>predeploy<\/strong> \u0438 <strong>deploy<\/strong> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 gh-pages.<\/p>\n<pre><code class=\"bash\">    \"predeploy\": \"rm -rf build &amp;&amp; npm run build\",     \"deploy\": \"gh-pages -d build\" <\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u044e homepage \u0432 package.json, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043e \u043d\u0430\u0448\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (js, css \u0444\u0430\u0439\u043b\u043e\u0432) \u0432 \u0441\u0431\u043e\u0440\u043a\u0435 \u0431\u044b\u043b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c))<\/p>\n<pre><code class=\"bash\">\"homepage\": \"https:\/\/robzarel.github.io\/gh-pages-demo\", <\/code><\/pre>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/b4e0e1c6e6735f70fb82dd68efcdde11b76041d2\" rel=\"noopener noreferrer nofollow\">feat: add production mode<\/a><\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Github Pages<\/h4>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 github \u0432 \u043d\u0430\u0448 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043d\u043e\u043f\u043e\u043a. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f (<a href=\"https:\/\/github.com\/userName\/repoName\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/userName\/repoName<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 (<a href=\"https:\/\/github.com\/userName\/repoName\/settings\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/userName\/repoName\/settings<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u0438\u0449\u0435\u043c \u0432 \u043b\u0435\u0432\u043e\u043c \u043c\u0435\u043d\u044e \u043a\u043d\u043e\u043f\u043a\u0443 pages \u0438 \u0437\u0430\u0445\u043e\u0434\u0438\u043c (<a href=\"https:\/\/github.com\/userName\/repoName\/settings\/pages\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/userName\/repoName\/settings\/pages<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u0438\u0449\u0435\u043c \u0441\u0435\u043a\u0446\u0438\u044e <strong>Build and deployment<\/strong>. \u0412 \u043d\u0435\u0439: 4.1 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <strong>Source<\/strong> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c <strong>Deploy from branch<\/strong> 4.2 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <strong>Branch<\/strong> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u0432\u0435\u0442\u043a\u0443 <strong>gh-pages<\/strong> 4.3 \u0436\u043c\u0451\u043c \u043a\u043d\u043e\u043f\u043a\u0443 <strong>save<\/strong><\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u0441\u0451, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043f\u0443\u0448\u0435 \u0432 \u0432\u0435\u0442\u043a\u0443 gh-pages, \u0432\u0430\u0448 \u0431\u0438\u043b\u0434 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 (\u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438) \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/useName.github.io\/repositoryName\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/useName.github.io\/repositoryName<\/strong><\/a>.<br \/> \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e <a href=\"https:\/\/robzarel.github.io\/gh-pages-demo\" rel=\"noopener noreferrer nofollow\">https:\/\/robzarel.github.io\/gh-pages-demo<\/a><\/p>\n<h3>\u0411\u043e\u043d\u0443\u0441: \u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u0440\u043e\u0443\u0442\u0438\u043d\u0433<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0435\u0448\u0438\u0442\u0435 \u043f\u0438\u043b\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u0440\u043e\u0443\u0442\u0438\u043d\u0433, \u0442\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u0430\u0448 react-router \u043d\u0435 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u0433\u0438\u0442\u0445\u0430\u0431 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0432\u0430\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f (\u0438\u043b\u0438 \u0431\u0430\u0433\u0430, \u043a\u0430\u043a \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c) \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u0431\u0438\u043b\u0434 \u0444\u0430\u0439\u043b <strong>404.html<\/strong> \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c \u0432\u0430\u0448\u0435\u0433\u043e <strong>index.html<\/strong>&#8230;.))) \u0414\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 <a href=\"https:\/\/www.npmjs.com\/package\/shx\" rel=\"noopener noreferrer nofollow\">shx<\/a> (\u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b )<\/p>\n<pre><code class=\"bash\">  npm install --save-dev shx <\/code><\/pre>\n<p>\u0418 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0438\u043b\u0434\u0430<\/p>\n<pre><code class=\"bash\">    \"build\": \"react-scripts build &amp;&amp; npm run save-json-api &amp;&amp; shx cp build\/index.html build\/404.html\", <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043f\u043e \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0443\u0440\u043b\u0443, \u0433\u0438\u0442\u0445\u0430\u0431 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c 404.html \u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f (\u0442.\u0435. \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u0440\u043e\u0443\u0442\u0438\u043d\u0433)<\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/0ec524d63ffd686a74b714b1bdfd0b2144620f32\" rel=\"noopener noreferrer nofollow\">feat: workaround for client side routing<\/a><\/p>\n<h3>\u0418\u0442\u043e\u0433\u043e<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<pre><code class=\"bash\">  npm run deploy <\/code><\/pre>\n<p>\u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 build \u043e\u0442 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0438\u0442\u043e\u0433 \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u0441\u044f \u0432 \u0432\u0435\u0442\u043a\u0443 gh-pages \u0432 \u043d\u0430\u0448 github \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>github action \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0441\u043a\u0430\u0442\u044f\u0442 \u0431\u0438\u043b\u0434<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0444\u0438\u0442))<\/p>\n<p>\u0412\u0441\u0451, \u043d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430)<br \/> \u041c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d \u0440\u0435\u0436\u0438\u043c\u0430 )<\/p>\n<p>\u0423\u0434\u0430\u0447\u0438 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0430\u0448\u0438\u0445 pet \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432))<\/p>\n<p>PS:<br \/> \u0421\u0441\u044b\u043b\u043a\u0438 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u0434 <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\" rel=\"noopener noreferrer nofollow\">gh-pages-demo<\/a>. <\/p>\n<ul>\n<li>\n<p>\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/49de62e0a76e19820c1ee4bf9c5d973244ff8ff0\" rel=\"noopener noreferrer nofollow\">feat: initial commit<\/a><\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0431\u044d\u043a <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/5d4cc2234e7af7d64b48d5c298251d04b4b612aa\" rel=\"noopener noreferrer nofollow\">feat: add json-server<\/a><\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0444\u0440\u043e\u043d\u0442 <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/65788cff3e70a8f812238a83a9bf3539c42f94cc\" rel=\"noopener noreferrer nofollow\">feat: render api data<\/a><\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0440\u043e\u0434 \u0440\u0435\u0436\u0438\u043c <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/b4e0e1c6e6735f70fb82dd68efcdde11b76041d2\" rel=\"noopener noreferrer nofollow\">feat: add production mode<\/a><\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u0434\u0435\u043f\u043b\u043e\u0439 <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/9d86d13a5e321469fcf94baed5290573f5ac18e2\" rel=\"noopener noreferrer nofollow\">feat: add deploy scripts<\/a><\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/0ec524d63ffd686a74b714b1bdfd0b2144620f32\" rel=\"noopener noreferrer nofollow\">feat: workaround for client side routing<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Npm \u043f\u0430\u043a\u0435\u0442\u044b: <a href=\"https:\/\/github.com\/typicode\/json-server\" rel=\"noopener noreferrer nofollow\">json-server<\/a>, <a href=\"https:\/\/www.npmjs.com\/package\/gh-pages\" rel=\"noopener noreferrer nofollow\">gh-pages<\/a>, <a href=\"https:\/\/www.npmjs.com\/package\/shx\" rel=\"noopener noreferrer nofollow\">shx<\/a>, <a href=\"https:\/\/github.com\/bpedro\/node-fs\" rel=\"noopener noreferrer nofollow\">node-fs<\/a><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0447\u0435\u0435 <\/p>\n<ul>\n<li>\n<p>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f <a href=\"https:\/\/github.com\/signup\" rel=\"noopener noreferrer nofollow\">github.com\/signup<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e <a href=\"https:\/\/docs.github.com\/en\/pages\/getting-started-with-github-pages\/about-github-pages\" rel=\"noopener noreferrer nofollow\">github pages<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e CRA <a href=\"https:\/\/create-react-app.dev\/docs\/adding-typescript\/\" rel=\"noopener noreferrer nofollow\">react-create-app<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/unions-and-intersections.html\" rel=\"noopener noreferrer nofollow\">union type<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e <a href=\"https:\/\/react.dev\/reference\/react\/useEffect\" rel=\"noopener noreferrer nofollow\">useEffect<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e <a href=\"https:\/\/react.dev\/reference\/react\/useState\" rel=\"noopener noreferrer nofollow\">useState<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e <a href=\"https:\/\/stackoverflow.com\/a\/62764510\/21579892\" rel=\"noopener noreferrer nofollow\">keyof typeof<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0440\u043e\u0443\u0442\u044b <a href=\"https:\/\/github.com\/typicode\/json-server#add-custom-routes\" rel=\"noopener noreferrer nofollow\">add-custom-routes<\/a><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e \u0440\u0430\u0437\u0434\u0430\u0447\u0443 \u0441\u0442\u0430\u0442\u0438\u043a\u0438 <a href=\"https:\/\/github.com\/typicode\/json-server#static-file-server\" rel=\"noopener noreferrer nofollow\">static-file-server<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/sites.tufts.edu\/cbi\/files\/2013\/01\/linux_cheat_sheet.pdf\" rel=\"noopener noreferrer nofollow\">linux cheat sheet<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/732546\/\"> https:\/\/habr.com\/ru\/articles\/732546\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0433\u0430\u0439\u0434 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c github pages \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 fullstack pet \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c \u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445)<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0432\u043e\u0434\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0451\u043d \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442 \u0438\u0437 \u0432\u0435\u0442\u043a\u0438 <strong>main<\/strong> \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\" rel=\"noopener noreferrer nofollow\">gh-pages-demo<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c unix \u043a\u043e\u043c\u0430\u043d\u0434 <strong>mkdir<\/strong>, <strong>cd<\/strong>, <strong>touch<\/strong>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043b\u0435\u0433\u043a\u043e \u0433\u0443\u0433\u043b\u044f\u0442\u0441\u044f. \u0414\u043b\u044f \u043b\u0435\u043d\u0438\u0432\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c <a href=\"https:\/\/sites.tufts.edu\/cbi\/files\/2013\/01\/linux_cheat_sheet.pdf\" rel=\"noopener noreferrer nofollow\">linux cheat sheet<\/a><\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0433\u0438\u0442\u043e\u043c \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u041d\u043e \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0433\u043e GUI.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043b\u0430\u043d<\/h3>\n<p>\u041f\u043b\u0430\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c &#171;backend&#187;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c frontend<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c production \u0440\u0435\u0436\u0438\u043c<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0435\u043f\u043b\u043e\u0439 \u043d\u0430 github pages<\/p>\n<\/li>\n<li>\n<p>\u0411\u043e\u043d\u0443\u0441<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h3>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0437\u0430\u0441\u0435\u0442\u0430\u043f\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u044c github<\/h4>\n<p>\u0411\u0435\u0440\u0451\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0438\u043b\u0438 \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 <a href=\"https:\/\/github.com\/signup\" rel=\"noopener noreferrer nofollow\">github.com\/signup<\/a>.<br \/> \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<br \/> \u042f \u0437\u0430\u0432\u0435\u0434\u0443 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <strong>gh-pages-demo<\/strong><\/p>\n<h4>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:<\/h4>\n<pre><code class=\"bash\">- cd Documents\/projects - git clone git@github.com:robzarel\/gh-pages-demo.git <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e ssh, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 http \u0438\u043b\u0438 zip \u0430\u0440\u0445\u0438\u0432\u043e\u043c.<\/p>\n<h4>\u0421\u0435\u0442\u0430\u043f\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h4>\n<p>C\u0435\u0442\u0430\u043f\u0438\u043c <strong>typescript<\/strong> \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/create-react-app.dev\/docs\/adding-typescript\/\" rel=\"noopener noreferrer nofollow\">react-create-app<\/a><\/p>\n<pre><code class=\"bash\">- cd gh-pages-demo - npx create-react-app . --template typescript <\/code><\/pre>\n<p>PS:<br \/> <strong>npx<\/strong> \u044d\u0442\u043e runner \u0434\u043b\u044f npm \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u041e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438\u0445, \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e <a href=\"https:\/\/www.npmjs.com\/package\/npx\" rel=\"noopener noreferrer nofollow\">npx<\/a> \u0438 <a href=\"https:\/\/www.codingninjas.com\/codestudio\/library\/difference-between-npm-and-npx\" rel=\"noopener noreferrer nofollow\">npm vs npx<\/a><\/p>\n<h4>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c<\/h4>\n<pre><code class=\"bash\">- git add . - git commit -m \"feat: initial commit\" - git push <\/code><\/pre>\n<h4>\u041a\u043e\u0434:<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/49de62e0a76e19820c1ee4bf9c5d973244ff8ff0\" rel=\"noopener noreferrer nofollow\">feat: initial commit<\/a><\/p>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c &#171;backend&#187;<\/h3>\n<p>&#171;backend&#187; \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/typicode\/json-server\" rel=\"noopener noreferrer nofollow\">json-server<\/a>.<br \/> &#171;backend&#187; \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043a\u043e\u0432\u044b\u0447\u043a\u0430\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0438\u043c\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0431\u044d\u043a\u0430, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0444\u0430\u0439\u043b\u0430\u0445)<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c json-server<\/h4>\n<pre><code class=\"bash\">  npm install --save-dev json-server <\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e<\/h4>\n<p>\u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 &#171;\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435&#187; \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<pre><code class=\"bash\">- cd src - mkdir server - cd server <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 api<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c json-server \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u0430\u043f\u0438 \u0431\u044b\u043b\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c <strong>api<\/strong><\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b <strong>routes.json<\/strong><\/p>\n<pre><code class=\"bash\">- touch routes.json <\/code><\/pre>\n<p>\u041d\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code class=\"json\">{ \"\/api\/*\": \"\/$1\" } <\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u0432 json-server: <a href=\"https:\/\/github.com\/typicode\/json-server#add-custom-routes\" rel=\"noopener noreferrer nofollow\">add-custom-routes<\/a><\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b json-server \u043c\u043e\u0433 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"bash\">- mkdir db - cd db - touch data.json - touch index.js <\/code><\/pre>\n<h3>index.js<\/h3>\n<p>\u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0438\u0442\u044c json-server:<\/p>\n<pre><code class=\"javascript\">const data = require('.\/data.json');  module.exports = () => ({   data: data, }); <\/code><\/pre>\n<h3>data.json<\/h3>\n<p>\u0421\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 index.js:<\/p>\n<pre><code class=\"json\">{ \"greeting\": \"Hello world\" } <\/code><\/pre>\n<p>PS:<br \/> \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 <strong>module.exports<\/strong> \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 <strong>\u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442. \u042d\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 api \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0444\u0440\u043e\u043d\u0442\u0430.<\/p>\n<h4>\u041f\u0438\u0448\u0435\u043c npm scripts<\/h4>\n<p>\u0412 \u0441\u0435\u043a\u0446\u0438\u0438 scripts \u043d\u0430\u0448\u0435\u0433\u043e package.json \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u043a\u0440\u0438\u043f\u0442 <strong>serve<\/strong> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u0448\u0435\u0433\u043e <strong>json-server<\/strong>:<\/p>\n<pre><code class=\"bash\">    \"serve\": \"json-server --watch .\/src\/server\/db\/index.js --routes .\/src\/server\/routes.json --port 3001\", <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0438\u043c \u043d\u0430\u0448 json-server \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d<\/p>\n<ul>\n<li>\n<p>\u0431\u0440\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e <strong>index.js<\/strong>,<\/p>\n<\/li>\n<li>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0440\u043e\u0443\u0442\u044b \u0438\u0437 <strong>routes.json<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u043e\u0440\u0442 3001<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<pre><code class=\"bash\">  npm run serve <\/code><\/pre>\n<p>\u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:3001\/api\/data\" rel=\"noopener noreferrer nofollow\"><strong>http:\/\/localhost:3001\/api\/data<\/strong><\/a> \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0430\u0448\u0435\u0433\u043e json \u0444\u0430\u0439\u043b\u0438\u043a\u0430. \u041a\u0440\u0430\u0441\u043e\u0442\u0430.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0444\u0440\u043e\u043d\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/5d4cc2234e7af7d64b48d5c298251d04b4b612aa\" rel=\"noopener noreferrer nofollow\">feat: add json-server<\/a><\/p>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c frontend<\/h3>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0444\u0440\u043e\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0430\u0448 \u0441\u0432\u0435\u0436\u0435\u043d\u044c\u043a\u0438\u0439 \u0431\u044d\u043a\u0435\u043d\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <strong>Hello World<\/strong><\/p>\n<h4>API \u043c\u043e\u0434\u0443\u043b\u044c<\/h4>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0430\u0448\u0438\u043c \u0441\u0432\u0435\u0436\u0438\u043c api \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u044d\u043a\u043e\u043c.<\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0444\u0435\u0442\u0447\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430 json \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u043d\u0430\u0448 \u0431\u044d\u043a, \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0438\u0445 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c json \u0432 \u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<pre><code class=\"typescript\">import getEndpoints from '..\/server\/db';  const endpoints = getEndpoints();  type ENDPOINTS = keyof typeof endpoints; type RESPONSE_DATA = {   greeting: string; };  const getJson = async &lt;T>(endpoint: ENDPOINTS): Promise&lt;T> => {   const path = `http:\/\/localhost:3001\/api\/${endpoint}`;   const response = await fetch(path);    return await response.json(); };  type API = {   get: {     data: () => Promise&lt;RESPONSE_DATA>;   }; }; const api: API = {   get: {     data: () => getJson&lt;RESPONSE_DATA>('data'),   }, };  export type { RESPONSE_DATA, ENDPOINTS }; export default api; <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0432 <strong>module.exports<\/strong> \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u044d\u043d\u0434\u043f\u043e\u0439\u043d\u0442\u0430\u043c. \u0414\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0443\u0442\u0451\u043c \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0444\u0435\u0442\u0447\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <strong>keyof typeof<\/strong>)<br \/> \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432 <strong>ENDPOINTS<\/strong> <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/unions-and-intersections.html\" rel=\"noopener noreferrer nofollow\">union type<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0440\u0443\u0447\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e &#171;\u0431\u044d\u043a\u0435\u043d\u0434\u0430&#187;. \u0418 typescript \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0440\u0443\u0447\u043a\u0435 (\u043a\u0430\u043a\u0443\u044e \u0431\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 module.exports \u043c\u044b \u0431\u044b \u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0438).<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e <a href=\"https:\/\/stackoverflow.com\/a\/62764510\/21579892\" rel=\"noopener noreferrer nofollow\">keyof typeof<\/a>.<\/p>\n<p>PS:<br \/> \u041f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0443\u0447\u0435\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0440\u0430\u0437\u043d\u043e\u0441\u0438\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0440\u0443\u0447\u0435\u043a \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c, \u0430 index.ts \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c.<\/p>\n<h4>\u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<p>\u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0445\u0443\u043a\u0430 <a href=\"https:\/\/react.dev\/reference\/react\/useEffect\" rel=\"noopener noreferrer nofollow\"><strong>useEffect<\/strong><\/a><br \/> \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0435\u0439\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/react.dev\/reference\/react\/useState\" rel=\"noopener noreferrer nofollow\">useState<\/a><\/p>\n<pre><code class=\"typescript\">import React, { useEffect, useState } from 'react';  import api from '.\/api'; import type { RESPONSE_DATA } from '.\/api';  import '.\/App.css';  function App() {   const [data, setData] = useState&lt;RESPONSE_DATA>();    useEffect(() => {     const fetchData = async () => {       const response = await api.get.data();       setData(response);     };      fetchData();   }, []);    return &lt;div className='App'>{data ? &lt;p>{data.greeting}&lt;\/p> : 'no data'}&lt;\/div>; }  export default App; <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432 2\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u0445 \u043a\u043e\u043c\u0430\u043d\u0434<\/p>\n<pre><code class=\"bash\">npm run serve <\/code><\/pre>\n<p>\u0438<\/p>\n<pre><code class=\"bash\">npm start <\/code><\/pre>\n<p>\u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:3000\" rel=\"noopener noreferrer nofollow\"><strong>http:\/\/localhost:3000<\/strong><\/a> \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 <a href=\"http:\/\/localhost:3001\/api\/data\" rel=\"noopener noreferrer nofollow\"><strong>http:\/\/localhost:3001\/api\/data<\/strong><\/a> \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/robzarel\/gh-pages-demo\/commit\/65788cff3e70a8f812238a83a9bf3539c42f94cc\" rel=\"noopener noreferrer nofollow\">feat: render api data<\/a><\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c production \u0440\u0435\u0436\u0438\u043c<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 2 \u0432\u043e\u043f\u0440\u043e\u0441\u0430:<\/p>\n<ul>\n<li>\n<p>\u0433\u0434\u0435 \u043d\u0430\u043c \u0445\u043e\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u043a\u043b\u0430\u0434\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u0445\u043e\u0441\u0442<\/p>\n<\/li>\n<\/ul>\n<h4>Hosting &#171;\u0441\u0435\u0440\u0432\u0435\u0440\u0430&#187;<\/h4>\n<p>Github \u0448\u0442\u0443\u043a\u0430 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0430\u044f \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0430\u043f\u0438, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0430\u043c.<\/p>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0448\u0438 \u0444\u0430\u0439\u043b\u044b \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 \u0434\u043e\u043c\u0435\u043d\u0435 <a href=\"https:\/\/raw.githubusercontent.com\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/raw.githubusercontent.com<\/strong><\/a><br \/> \u0410 \u043f\u0443\u0442\u044c \u043a \u043d\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<br \/> <a href=\"https:\/\/raw.githubusercontent.com\/userName\/projectName\/branchName\/relative-directory-path\/fileName\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/raw.githubusercontent.com\/userName\/projectName\/branchName\/relative-directory-path\/fileName<\/strong><\/a>, \u0433\u0434\u0435:<\/p>\n<ul>\n<li>\n<p><strong>userName<\/strong> &#8212; \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 gitHub<\/p>\n<\/li>\n<li>\n<p><strong>branchName<\/strong> &#8212; \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0442\u043a\u0438 \u0432 git<\/p>\n<\/li>\n<li>\n<p><strong>relative<\/strong>-directory-path &#8212; \u043f\u0443\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0434\u043e \u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><strong>fileName<\/strong> &#8212; \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 data.json)<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u0432 \u043d\u0430\u0448\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e backend \u044d\u043d\u0434\u043f\u043e\u0439\u043d\u0442\u043e\u0432. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043d\u0438\u043c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0442\u043a\u0443 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c gh-pages (\u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u0435).<br \/> \u0418 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a-\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0431\u043e\u0440\u043a\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <strong>static\/db<\/strong>.<br \/> \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u0439\u043b <strong>data.json<\/strong> \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443:<\/p>\n<p><a href=\"https:\/\/raw.githubusercontent.com\/robzarel\/gh-pages-demo\/gh-pages\/static\/db\/data.json\" rel=\"noopener noreferrer nofollow\"><strong>https:\/\/raw.githubusercontent.com\/robzarel\/gh-pages-demo\/gh-pages\/static\/db\/data.json<\/strong><\/a><\/p>\n<h4>\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0430 Fronetnd<\/h4>\n<h3>API \u043c\u043e\u0434\u0443\u043b\u044c<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 &#8212; <strong>development<\/strong> \u0438 <strong>production<\/strong><\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f NODE_ENV (\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 CRA \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <strong>process.env.NODE_ENV<\/strong>) \u0438 \u0441 \u0435\u0451 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c API \u043c\u043e\u0434\u0443\u043b\u044c. \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u043a\u0438 &#8212; \u0432 development \u0440\u0435\u0436\u0438\u043c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u043d\u0430\u0448 json-server, \u0430 \u0432 production \u0440\u0435\u0436\u0438\u043c\u0435 &#8212; \u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 <a href=\"http:\/\/raw.githubusercontent.com\" rel=\"noopener noreferrer nofollow\">raw.githubusercontent.com<\/a>.<br \/> \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>getJson<\/strong>:<\/p>\n<pre><code class=\"typescript\">const getJson = async &lt;T>(endpoint: ENDPOINTS): Promise&lt;T> => {   const path =     process.env.NODE_ENV === 'development'       ? `http:\/\/localhost:3001\/api\/${endpoint}`       : `https:\/\/raw.githubusercontent.com\/robzarel\/gh-pages-demo\/gh-pages\/static\/db\/${endpoint}.json`;    const response = await fetch(path);    return await response.json(); }; <\/code><\/pre>\n<h3>\u0412\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u043a\u0438 \u0432 \u0431\u0438\u043b\u0434<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0438 \u0444\u0430\u0439\u043b\u044b \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043f\u0440\u043e\u0434\u043e\u0432\u0443\u044e \u0441\u0431\u043e\u0440\u043a\u0443, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0445 \u0442\u0443\u0434\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/bpedro\/node-fs\" rel=\"noopener noreferrer nofollow\">node-fs<\/a> \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0444\u0430\u0439\u043b\u044b \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 build \u043f\u043e \u043d\u0443\u0436\u043d\u043e\u043c\u0443 &#171;\u0430\u0434\u0440\u0435\u0441\u0443&#187;.<\/p>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c node-fs<\/strong><\/p>\n<pre><code class=\"bash\">  npm install --save-dev node-fs <\/code><\/pre>\n<p><strong>\u041f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u0437\u043e\u0432\u0451\u043c save-json-api.js \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 src\/server\/scripts<\/p>\n<pre><code class=\"bash\">  cd src\/server   mkdir scripts   cd scripts   touch save-json-api.js <\/code><\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0431\u0443\u0434\u0435\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <strong>static\/db<\/strong>:<\/p>\n<pre><code class=\"javascript\">const fs = require('node-fs'); const getDb = require('..\/db');  const db = getDb();  fs.mkdir('.\/build\/static\/db', () => {   for (let [key, value] of Object.entries(db)) {     fs.writeFile(       `.\/build\/static\/db\/${key}.json`,       JSON.stringify(value),       (err) => {         if (err) throw err;       }     );   } }); <\/code><\/pre>\n<p>\u0418 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 npm script \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">    \"save-json-api\": \"node .\/src\/scripts\/save-json-api.js\",     \"build\": \"react-scripts build &amp;&amp; npm run save-json-api\", <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 npm run build \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e <strong>src\/server\/db\/index.js<\/strong>.<\/p>\n<p>PS:<br \/> \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u044b \u0432 module.exports \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0430 \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442, \u043c\u044b \u0434\u043e\u0431\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u0440\u043e\u0434\u0435.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u043e\u0432\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-412857","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/412857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=412857"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/412857\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=412857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=412857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=412857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}