{"id":283388,"date":"2017-01-04T13:30:04","date_gmt":"2017-01-04T10:30:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283388"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283388","title":{"rendered":"json-api-normalizer: \u043b\u0435\u0433\u043a\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c Redux \u0438 JSON API"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/325\/507\/e71\/325507e71b1c43399d89018f3601ae6f.jpg\" alt=\"JSON API + redux\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 <a href=\"http:\/\/jsonapi.org\/\">JSON API<\/a> \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0430\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 API, \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044f \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u0430\u043a \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0442\u0430\u043a \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u044f\u0441\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0430\u0439\u0437\u0435\u0440\u043e\u0432 \u0438 \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u0432 \u0432 \u0441\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437.<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"json-api-vs-tipichnye-veb-servisy\">JSON API vs \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u044b<\/h1>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f JSON API, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 pagination, sorting \u0438 filtering. <\/p>\n<p>  <\/p>\n<h4 id=\"tipichnyy-veb-servis\">\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441<\/h4>\n<p>  <\/p>\n<pre><code>{   &quot;id&quot;: &quot;123&quot;,   &quot;author&quot;: {     &quot;id&quot;: &quot;1&quot;,     &quot;name&quot;: &quot;Paul&quot;   },   &quot;title&quot;: &quot;My awesome blog post&quot;,   &quot;comments&quot;: [     {       &quot;id&quot;: &quot;324&quot;,       &quot;text&quot;: &quot;Great job, Bro!&quot;,       &quot;commenter&quot;: {         &quot;id&quot;: &quot;2&quot;,         &quot;name&quot;: &quot;Nicole&quot;       }     }   ] }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"json-api\">JSON API<\/h4>\n<p>  <\/p>\n<pre><code>{   &quot;data&quot;: [{      &quot;type&quot;: &quot;post&quot;,      &quot;id&quot;: &quot;123&quot;,      &quot;attributes&quot;: {         &quot;id&quot;: 123,         &quot;title&quot;: &quot;My awesome blog post&quot;      },      &quot;relationships&quot;: {         &quot;author&quot;: {           &quot;type&quot;: &quot;user&quot;,           &quot;id&quot;: &quot;1&quot;         },         &quot;comments&quot;: {           &quot;type&quot;:  &quot;comment&quot;,           &quot;id&quot;: &quot;324&quot;         }      }        }],   &quot;included: [{     &quot;type&quot;: &quot;user&quot;,     &quot;id&quot;: &quot;1&quot;,     &quot;attributes&quot;: {       &quot;id&quot;: 1,       &quot;name&quot;: &quot;Paul&quot;     }   }, {     &quot;type&quot;: &quot;user&quot;,     &quot;id&quot;: &quot;2&quot;,     &quot;attributes&quot;: {       &quot;id&quot;: 2,       &quot;name&quot;: &quot;Nicole&quot;     }   }, {     &quot;type&quot;: &quot;comment&quot;,     &quot;id&quot;: &quot;324&quot;,     &quot;attributes&quot;: {       &quot;id&quot;: 324,       &quot;text&quot;: &quot;Great job, Bro!&quot;     },      &quot;relationships&quot;: {       &quot;commenter&quot;: {         &quot;type&quot;: &quot;user&quot;,         &quot;id&quot;: &quot;2&quot;       }     }   }]  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a JSON API \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 API \u2014 \u044d\u0442\u043e \u0435\u0433\u043e &quot;\u0431\u043e\u043b\u0442\u043b\u0438\u0432\u043e\u0441\u0442\u044c&quot;, \u043d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e? <\/p>\n<p>  <\/p>\n<table>\n<thead>\n<tr>\n<th>\u0422\u0438\u043f<\/th>\n<th>\u0414\u043e \u0441\u0436\u0430\u0442\u0438\u044f (\u0431\u0430\u0439\u0442)<\/th>\n<th>\u041f\u043e\u0441\u043b\u0435 \u0441\u0436\u0430\u0442\u0438\u044f (\u0431\u0430\u0439\u0442)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 JSON<\/td>\n<td>264<\/td>\n<td>170<\/td>\n<\/tr>\n<tr>\n<td>JSON API<\/td>\n<td>771<\/td>\n<td>293<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 gzip \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0430 \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0436\u0435 \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e. <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0442\u0435\u0441\u0442, \u0433\u0434\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 JSON API \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0432 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u043c JSON: \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0430\u0447\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0442\u044b \u0431\u043b\u043e\u0433\u0430 \u0438 \u0438\u0445 \u0430\u0432\u0442\u043e\u0440\u0430, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0432 JSON API \u043e\u0431\u044a\u0435\u043a\u0442 &quot;\u0430\u0432\u0442\u043e\u0440&quot; \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0440\u0430\u0437, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0432 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u043c JSON \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430. <\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430\u0445: \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0430\u044f JSON API, \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043b\u043e\u0441\u043a\u043e\u0439 \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 redux. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 JSON API \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c &quot;\u0441\u0445\u0435\u043c\u044b&quot;, \u043a\u0430\u043a \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 <a href=\"https:\/\/github.com\/paularmstrong\/normalizr\">normalizr<\/a>. \u042d\u0442\u0430 \u0444\u0438\u0447\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u0432 \u0447\u0435\u043c \u043c\u044b \u0441\u043a\u043e\u0440\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  <\/p>\n<p><em>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 redux \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 state management \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u043e\u043f\u0440\u043e\u0441\u0443 <a href=\"http:\/\/stateofjs.com\/2016\/statemanagement\/\">State of JavaScript in 2016<\/a>, redux \u043f\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0435\u0440\u0435\u0436\u0430\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 redux \u0438 state management \u0432 JS \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u2014 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435.<\/em><\/p>\n<p>  <\/p>\n<h1 id=\"json-api-i-redux\">JSON API \u0438 redux<\/h1>\n<p>  <\/p>\n<p>JSON API \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u043b\u043e\u0445 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 redux, \u043e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 <code>data<\/code> \u0438 <code>included<\/code> \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043c\u044b\u0441\u043b, \u0432\u0435\u0434\u044c \u0438\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b\u0438, \u0430 \u043a\u0430\u043a\u0438\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 &quot;\u0432\u043f\u0440\u0438\u0434\u0430\u0447\u0443&quot;. \u041e\u0434\u043d\u0430\u043a\u043e, \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 store \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 \u043c\u044b \u0440\u0438\u0441\u043a\u0443\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043f\u0438\u0439 \u043e\u0434\u043d\u0438\u0445 \u0438 \u0442\u0435\u0445 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u0447\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442 \u043b\u0443\u0447\u0448\u0438\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430\u043c redux.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 JSON API \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 \u0432 redux \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u043a\u0430\u043a \u0441 Map.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/yury-dymov\/json-api-normalizer\">json-api-normalizer<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044f merge <code>data<\/code> \u0438 <code>included<\/code>;<\/li>\n<li>\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 Map \u0432\u0438\u0434\u0430 <code>id =&gt; \u043e\u0431\u044a\u0435\u043a\u0442<\/code>;<\/li>\n<li>\u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 JSON API \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 <code>meta<\/code>;<\/li>\n<li>\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 one-to-many \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043f\u0443\u043d\u043a\u0442\u0430\u0445 3 \u0438 4. <\/p>\n<p>  <\/p>\n<p>Redux, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 store, \u0447\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e offline \u0440\u0435\u0436\u0438\u043c\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043e\u0434\u043d\u0438\u043c\u0438 \u0438 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0437\u044f\u0442\u044c \u0438\u0437 store \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430. json-api-normalizer \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 <code>meta<\/code> \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 JSON API \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 store, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>json-api-normalizer \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439<\/p>\n<p>  <\/p>\n<pre><code>{   &quot;relationships&quot;: {     &quot;comments&quot;: [{       &quot;type&quot;: &quot;comment&quot;,       &quot;id&quot;: &quot;1&quot;,     }, {       &quot;type&quot;: &quot;comment&quot;,       &quot;id&quot;: &quot;2&quot;,         }, {       &quot;type&quot;: &quot;comment&quot;,       &quot;id&quot;: &quot;3&quot;,         }]   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0432 \u0441\u043b\u0435\u0434\u0443\u0449\u0438\u0439 \u0432\u0438\u0434<\/p>\n<p>  <\/p>\n<pre><code>{   &quot;relationships&quot;: {     &quot;comments&quot;: {       &quot;type&quot;: &quot;comment&quot;,       &quot;id&quot;: &quot;1,2,3&quot;     }   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 redux state \u0447\u0435\u0440\u0435\u0437 merge, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0448\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0438 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043d\u0435\u0433\u043e: \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 merge \u043c\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 &quot;id&quot; \u0434\u0440\u0443\u0433\u043e\u0439, \u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0430 \u0432 \u043e\u0434\u0438\u043d \u0448\u0430\u0433. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 pull request&#8217;\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0446\u0438\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<h1 id=\"prakticheskiy-primer\">\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h1>\n<p>  <\/p>\n<h2 id=\"1-skachivaem-zagotovku\">1. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0443<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 JSON API \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 <a href=\"http:\/\/www.phoenixframework.org\">Phoenix Framework<\/a>. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"https:\/\/github.com\/yury-dymov\/phoenix-json-api-example\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u044b.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b <a href=\"https:\/\/github.com\/yury-dymov\/json-api-react-redux-example\/tree\/initial\">\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 React<\/a>. <\/p>\n<p>  <\/p>\n<p>\u0421 \u044d\u0442\u043e\u0439 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u043c\u044b \u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0421\u0434\u0435\u043b\u0430\u0439\u0442\u0435 git clone \u044d\u0442\u043e\u0439 \u0432\u0435\u0442\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/yury-dymov\/json-api-react-redux-example.git --branch initial<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0443\u0442:<\/p>\n<p>  <\/p>\n<ul>\n<li>React \u0438 ReactDOM<\/li>\n<li>Redux \u0438 Redux DevTools<\/li>\n<li>Webpack<\/li>\n<li>Eslint<\/li>\n<li>Babel<\/li>\n<li>\u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0434\u0432\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430, \u0440\u0430\u0431\u043e\u0447\u0438\u0439 eslint \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f redux store<\/li>\n<li>\u0421\u0442\u0438\u043b\u0438 \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 &quot;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&quot;.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">npm run webpack-dev-server<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438 \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 <a href=\"http:\/\/localhost:8050\"><code>http:\/\/localhost:8050<\/code><\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"2-integriruemsya-s-api\">2. \u0418\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0441 API<\/h2>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c redux middleware, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 API. \u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c json-api-normalizer, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 redux action \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<h4 id=\"srcreduxmiddlewareapijs\">src\/redux\/middleware\/api.js<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import fetch from 'isomorphic-fetch'; import normalize from 'json-api-normalizer';  const API_ROOT = 'https:\/\/phoenix-json-api-example.herokuapp.com\/api';  export const API_DATA_REQUEST = 'API_DATA_REQUEST'; export const API_DATA_SUCCESS = 'API_DATA_SUCCESS'; export const API_DATA_FAILURE = 'API_DATA_FAILURE';  function callApi(endpoint, options = {}) {   const fullUrl = (endpoint.indexOf(API_ROOT) === -1) ? API_ROOT + endpoint : endpoint;    return fetch(fullUrl, options)     .then(response =&gt; response.json()       .then((json) =&gt; {         if (!response.ok) {           return Promise.reject(json);         }          return Object.assign({}, normalize(json, { endpoint }));       }),     ); }  export const CALL_API = Symbol('Call API');  export default function (store) {   return function nxt(next) {     return function call(action) {       const callAPI = action[CALL_API];        if (typeof callAPI === 'undefined') {         return next(action);       }        let { endpoint } = callAPI;       const { options } = callAPI;        if (typeof endpoint === 'function') {         endpoint = endpoint(store.getState());       }        if (typeof endpoint !== 'string') {         throw new Error('Specify a string endpoint URL.');       }        const actionWith = (data) =&gt; {         const finalAction = Object.assign({}, action, data);         delete finalAction[CALL_API];         return finalAction;       };        next(actionWith({ type: API_DATA_REQUEST, endpoint }));        return callApi(endpoint, options || {})         .then(           response =&gt; next(actionWith({ response, type: API_DATA_SUCCESS, endpoint })),           error =&gt; next(actionWith({ type: API_DATA_FAILURE, error: error.message || 'Something bad happened' })),         );     };   }; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u044f &quot;\u043c\u0430\u0433\u0438\u044f&quot;: \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 middleware \u043c\u044b \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e json-api-normalizer \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0438\u0445 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435.<\/p>\n<p>  <\/p>\n<p><em>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0435\u0441\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e &quot;\u0434\u043e\u043f\u0438\u043b\u0438\u0442\u044c&quot; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u0434\u043b\u044f production.<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c middleware \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e store:<\/p>\n<p>  <\/p>\n<h4 id=\"srcreduxconfigurestorejs\">src\/redux\/configureStore.js<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">... +++ import api from '.\/middleware\/api';  export default function (initialState = {}) {   const store = createStore(rootReducer, initialState, compose( --- applyMiddleware(thunk),   +++ applyMiddleware(thunk, api),     DevTools.instrument(), ...    <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0439 action:<\/p>\n<p>  <\/p>\n<h4 id=\"srcreduxactionspostjs\">src\/redux\/actions\/post.js<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { CALL_API } from '..\/middleware\/api';  export function test() {   return {     [CALL_API]: {       endpoint: '\/test',     },   }; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c reducer:<\/p>\n<p>  <\/p>\n<h4 id=\"srcreduxreducersdatajs\">src\/redux\/reducers\/data.js<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import merge from 'lodash\/merge'; import { API_DATA_REQUEST, API_DATA_SUCCESS } from '..\/middleware\/api';  const initialState = {   meta: {}, };  export default function (state = initialState, action) {   switch (action.type) {     case API_DATA_SUCCESS:       return merge(         {},         state,         merge({}, action.response, { meta: { [action.endpoint]: { loading: false } } }),       );     case API_DATA_REQUEST:       return merge({}, state, { meta: { [action.endpoint]: { loading: true } } });     default:       return state;   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430\u0448 reducer \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e redux store:<\/p>\n<p>  <\/p>\n<h4 id=\"srcreduxreducersdatajs-1\">src\/redux\/reducers\/data.js<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { combineReducers } from 'redux'; import data from '.\/data';  export default combineReducers({   data, });<\/code><\/pre>\n<p>  <\/p>\n<p>Model \u0441\u043b\u043e\u0439 \u0433\u043e\u0442\u043e\u0432! \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u0441 UI.<\/p>\n<p>  <\/p>\n<h4 id=\"srccomponentscontentjsx\">src\/components\/Content.jsx<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import Button from 'react-bootstrap-button-loader'; import { test } from '..\/..\/redux\/actions\/test';  const propTypes = {   dispatch: PropTypes.func.isRequired,   loading: PropTypes.bool, };  function Content({ loading = false, dispatch }) {   function fetchData() {     dispatch(test());   }    return (     &lt;div&gt;       &lt;Button loading={loading} onClick={() =&gt; { fetchData(); }}&gt;Fetch Data from API&lt;\/Button&gt;     &lt;\/div&gt;   ); }  Content.propTypes = propTypes;  function mapStateToProps() {   return {}; }  export default connect(mapStateToProps)(Content);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 \u043d\u0430\u0436\u043c\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u2014 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Browser DevTools \u0438 Redux DevTools \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON API, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 redux store. \u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 UI.<\/p>\n<p>  <\/p>\n<h2 id=\"3-ispolzuem-dannye\">3. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>  <\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/yury-dymov\/redux-object\">redux-object<\/a> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 redux-store \u0432 JavaScript \u043e\u0431\u044a\u0435\u043a\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0440\u0435\u0434\u0443\u0441\u0435\u0440\u0430, \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 id, \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u043d\u0430 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0430\u043c\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import build, { fetchFromMeta } from 'redux-object';  console.log(build(state.data, 'post', '1')); \/\/ ---&gt; post console.log(fetchFromMeta(state.data, '\/posts')); \/\/ ---&gt; array of posts<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0441\u0432\u044f\u0437\u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0432 JavaScript property \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 lazy loading, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442-\u043f\u043e\u0442\u043e\u043c\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const post = build(state.data, 'post', '1'); \/\/ ---&gt; post object; `author` and `comments` properties are not loaded  post.author; \/\/ ---&gt; user object<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 UI, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<p>  <\/p>\n<p><em>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u044f \u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e \u043e\u043f\u0443\u0441\u043a\u0430\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0441\u0442\u0438\u043b\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0435\u043c\u044b \u0441\u0442\u0430\u0442\u044c\u0438.<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 store \u0438 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e connect \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:<\/p>\n<p>  <\/p>\n<h4 id=\"srccomponentscontentjsx-1\">src\/components\/Content.jsx<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import Button from 'react-bootstrap-button-loader'; import build from 'redux-object'; import { test } from '..\/..\/redux\/actions\/test'; import Question from '..\/Question';  const propTypes = {   dispatch: PropTypes.func.isRequired,   questions: PropTypes.array.isRequired,   loading: PropTypes.bool, };  function Content({ loading = false, dispatch, questions }) {   function fetchData() {     dispatch(test());   }    const qWidgets = questions.map(q =&gt; &lt;Question key={q.id} question={q} \/&gt;);    return (     &lt;div&gt;       &lt;Button loading={loading} onClick={() =&gt; { fetchData(); }}&gt;Fetch Data from API&lt;\/Button&gt;       {qWidgets}     &lt;\/div&gt;   ); }  Content.propTypes = propTypes;  function mapStateToProps(state) {   if (state.data.meta['\/test']) {     const questions = (state.data.meta['\/test'].data || []).map(object =&gt; build(state.data, 'question', object.id));     const loading = state.data.meta['\/test'].loading;      return { questions, loading };   }    return { questions: [] }; }  export default connect(mapStateToProps)(Content);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 &#8216;\/test&#8217;, \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c \u0430\u0439\u0434\u0438\u0448\u043d\u0438\u043a\u0438 \u0438 \u0441\u0442\u0440\u043e\u0438\u043c \u043f\u043e \u043d\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0442\u0438\u043f\u0430 &quot;Question&quot;, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 &quot;questions&quot;.<\/p>\n<p>  <\/p>\n<h4 id=\"srccomponentsquestionpackagejson\">src\/components\/Question\/package.json<\/h4>\n<p>  <\/p>\n<pre><code>{   &quot;name&quot;: &quot;Question&quot;,   &quot;version&quot;: &quot;0.0.0&quot;,   &quot;private&quot;: true,   &quot;main&quot;: &quot;.\/Question&quot; }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"srccomponentsquestionquestionjsx\">src\/components\/Question\/Question.jsx<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import React, { PropTypes } from 'react'; import Post from '..\/Post';  const propTypes = {   question: PropTypes.object.isRequired, };  function Question({ question }) {   const postWidgets = question.posts.map(post =&gt; &lt;Post key={post.id} post={post} \/&gt;);    return (     &lt;div className=&quot;question&quot;&gt;       {question.text}       {postWidgets}     &lt;\/div&gt;   ); }  Question.propTypes = propTypes;  export default Question;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043d\u0438\u0445.<\/p>\n<p>  <\/p>\n<h4 id=\"srccomonentspostpackagejson\">src\/comonents\/Post\/package.json<\/h4>\n<p>  <\/p>\n<pre><code>{   &quot;name&quot;: &quot;Post&quot;,   &quot;version&quot;: &quot;0.0.0&quot;,   &quot;private&quot;: true,   &quot;main&quot;: &quot;.\/Post&quot; }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"srccomponentspostpostjsx\">src\/components\/Post\/Post.jsx<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import React, { PropTypes } from 'react'; import Comment from '..\/Comment'; import User from '..\/User';  const propTypes = {   post: PropTypes.object.isRequired, };  function Post({ post }) {   const commentWidgets = post.comments.map(c =&gt; &lt;Comment key={c.id} comment={c} \/&gt;);    return (     &lt;div className=&quot;post&quot;&gt;       &lt;User user={post.author} \/&gt;       {post.text}       {commentWidgets}     &lt;\/div&gt;   ); }  Post.propTypes = propTypes;  export default Post;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<\/p>\n<p>  <\/p>\n<h4 id=\"srccomponentsuserpackagejson\">src\/components\/User\/package.json<\/h4>\n<p>  <\/p>\n<pre><code>{   &quot;name&quot;: &quot;User&quot;,   &quot;version&quot;: &quot;0.0.0&quot;,   &quot;private&quot;: true,   &quot;main&quot;: &quot;.\/User&quot; }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"srccomponentsuseruserjsx\">src\/components\/User\/User.jsx<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import React, { PropTypes } from 'react';  const propTypes = {   user: PropTypes.object.isRequired, };  function User({ user }) {   return &lt;span className=&quot;user&quot;&gt;{user.name}: &lt;\/span&gt;; }  User.propTypes = propTypes;  export default User;<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"srccomponentscommentpackagejson\">src\/components\/Comment\/package.json<\/h4>\n<p>  <\/p>\n<pre><code>{   &quot;name&quot;: &quot;Comment&quot;,   &quot;version&quot;: &quot;0.0.0&quot;,   &quot;private&quot;: true,   &quot;main&quot;: &quot;.\/Comment&quot; }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"srccomponentscommentcommentjsx\">src\/components\/Comment\/Comment.jsx<\/h4>\n<p>  <\/p>\n<pre><code class=\"javascript\">import React, { PropTypes } from 'react'; import User from '..\/User';  const propTypes = {   comment: PropTypes.object.isRequired, };  function Comment({ comment }) {   return (     &lt;div className=&quot;comment&quot;&gt;       &lt;User user={comment.author} \/&gt;       {comment.text}     &lt;\/div&gt;   ); }  Comment.propTypes = propTypes;  export default Comment;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435! \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0432\u0430\u0448 \u043a\u043e\u0434 \u0441 <a href=\"https:\/\/github.com\/yury-dymov\/json-api-react-redux-example\">\u043c\u0430\u0441\u0442\u0435\u0440-\u0432\u0435\u0442\u043a\u043e\u0439 \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><\/p>\n<p>  <\/p>\n<p>\u0416\u0438\u0432\u043e\u0435 \u0434\u0435\u043c\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0442\u0443\u0442 \u2014 <a href=\"https:\/\/yury-dymov.github.io\/json-api-react-redux-example\"><a href=\"https:\/\/yury-dymov.github.io\/json-api-react-redux-example\">https:\/\/yury-dymov.github.io\/json-api-react-redux-example<\/a><\/a><\/p>\n<p>  <\/p>\n<h1 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 json-api-normalizer \u0438 redux-object \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e. \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u0435, \u043d\u043e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043f\u0440\u0438\u0439\u0442\u0438 \u043a \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0433\u043e\u0434\u0430 \u0443\u0441\u043f\u0435\u043b \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u0433\u0440\u0430\u0431\u043b\u0435\u0439 \u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u044d\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<br \/>  \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u0438 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0447\u044c \u043c\u043d\u0435 \u0432 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0438 \u044d\u0442\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h1 id=\"ssylki\">\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f JSON API: <a href=\"http:\/\/jsonapi.org\/\">http:\/\/jsonapi.org\/<\/a><\/li>\n<li>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 json-api-normalizer: <a href=\"https:\/\/github.com\/yury-dymov\/json-api-normalizer\">https:\/\/github.com\/yury-dymov\/json-api-normalizer<\/a><\/li>\n<li>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 redux-object: <a href=\"https:\/\/github.com\/yury-dymov\/redux-object\">https:\/\/github.com\/yury-dymov\/redux-object<\/a><\/li>\n<li>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 \u0431\u0430\u0437\u0435 JSON API, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Phoenix Framework: <a href=\"https:\/\/phoenix-json-api-example.herokuapp.com\/api\/test\">https:\/\/phoenix-json-api-example.herokuapp.com\/api\/test<\/a><\/li>\n<li>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 \u0431\u0430\u0437\u0435 JSON API: <a href=\"https:\/\/github.com\/yury-dymov\/phoenix-json-api-example\">https:\/\/github.com\/yury-dymov\/phoenix-json-api-example<\/a><\/li>\n<li>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 React, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e JSON API: <a href=\"https:\/\/yury-dymov.github.io\/json-api-react-redux-example\">https:\/\/yury-dymov.github.io\/json-api-react-redux-example<\/a><\/li>\n<li>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 React, \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: <a href=\"https:\/\/github.com\/yury-dymov\/json-api-react-redux-example\/tree\/initial\">https:\/\/github.com\/yury-dymov\/json-api-react-redux-example\/tree\/initial<\/a><\/li>\n<li>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 React, \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: <a href=\"https:\/\/github.com\/yury-dymov\/json-api-react-redux-example\">https:\/\/github.com\/yury-dymov\/json-api-react-redux-example<\/a><\/li>\n<\/ol>\n<p> \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:\/\/habrahabr.ru\/post\/318958\/\"> https:\/\/habrahabr.ru\/post\/318958\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/325\/507\/e71\/325507e71b1c43399d89018f3601ae6f.jpg\" alt=\"JSON API + redux\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 <a href=\"http:\/\/jsonapi.org\/\">JSON API<\/a> \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0430\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 API, \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044f \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u0430\u043a \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0442\u0430\u043a \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u044f\u0441\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0430\u0439\u0437\u0435\u0440\u043e\u0432 \u0438 \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u0432 \u0432 \u0441\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437.<\/p>\n<p>  <\/p>\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-283388","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283388","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=283388"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283388\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}