{"id":461016,"date":"2025-05-26T09:11:00","date_gmt":"2025-05-26T09:11:00","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=461016"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=461016","title":{"rendered":"<span>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0432 JavaScript,\u00a0\u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 web \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 React, \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<\/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<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/de0\/501\/46e\/de050146e37ef6a3cf7fc92442e1d458.jpg\" alt=\"\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 JavaScript\" title=\"\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 JavaScript\" width=\"1204\" height=\"676\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/de0\/501\/46e\/de050146e37ef6a3cf7fc92442e1d458.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/de0\/501\/46e\/de050146e37ef6a3cf7fc92442e1d458.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 JavaScript<\/figcaption><\/div>\n<\/figure>\n<h2>\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0431 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0430\u044f \u043a\u043e\u0433\u0434\u0430 \u0438\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u0438\u0434\u0435\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0427\u0442\u043e \u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u0434\u0443 \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c?. \u041a\u043e\u0433\u0434\u0430 \u044f 2022 \u0433. \u0443\u0432\u043b\u0435\u043a\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043d\u0430 React (\u044d\u0442\u043e JavaScript \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430) \u0438 \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u0439\u0442 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f OpenWeatherMap, \u043f\u0435\u0440\u0432\u043e\u0435 \u0441 \u0447\u0435\u043c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043f\u043e \u0442\u0435\u043c\u0435 \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0438\u0448\u0443 \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 promise.<\/p>\n<h2>Promise<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044d\u0442\u043e \u043e\u0431\u0435\u0449\u0430\u0442\u044c, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043a \u0438 \u043e\u0448\u0438\u0431\u043a\u0430. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u0432\u0435\u0437\u0434\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u043e promise. \u042f \u043d\u0435\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u0430 \u0438 \u0441\u043a\u0430\u0436\u0435\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u0434\u0435 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c Promise.All() \u043e\u0431 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0438 \u043a\u0430\u043a \u043f\u0438\u0448\u0443 \u043a\u043e\u0434 \u0441\u0435\u0439\u0447\u0430\u0441.<\/p>\n<h3>Backend \u043a\u0430\u043a \u0431\u044b\u043b\u043e<\/h3>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b &#171;tableweather&#187; \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 PostgresSQL c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#171;getWeather&#187; \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0439 \u0432 Promise.<\/p>\n<pre><code class=\"javascript\">const getWeather = async (req, res) =&gt; {      return new Promise(function (resolve, reject) {         pool_weather.query(`SELECT * FROM tableweather`, (error, results) =&gt; {             if (error) {                 reject(error);             }             resolve(results.rows);         });     }); };<\/code><\/pre>\n<p>\u0423 Promise \u0435\u0441\u0442\u044c <strong><em>resolve<\/em><\/strong>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 <strong><em>reject<\/em><\/strong> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u0431\u044d\u043a\u0438. Result (&#171;\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442&#187;)  &#8212; \u0432\u043d\u0430\u0447\u0430\u043b\u0435\u00a0undefined, \u0434\u0430\u043b\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u00a0value\u00a0\u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u00a0resolve(value)\u00a0\u0438\u043b\u0438 \u043d\u0430\u00a0error\u00a0\u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u00a0reject(error).  \u041d\u0430\u0432\u0435\u0440\u043d\u043e \u0443 \u043a\u043e\u0433\u043e \u0442\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u0430 \u043f\u0440\u0438\u0447\u0435\u043c \u0437\u0434\u0435\u0441\u044c &#187;Backend&#187; ? \u041d\u0430 \u043d\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0438\u0436\u0435 \u0440\u0438\u04412. \u0424\u0443\u043d\u043a\u0446\u0438\u044e &#171;getWeather&#187; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f &#171;&#187;\/api\/getAllWeather&#187; \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 server.js \u0440\u0438\u04413. \u0413\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440  &#8212; Express.<\/p>\n<pre><code class=\"javascript\">app.get(`\/api\/getAllWeather`, cors(corsOptions), (req, res) =&gt; {   console.log(\"Weather in all - city\");     request.getWeather()     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); });<\/code><\/pre>\n<p>\u0440\u0438\u0441 2.<\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441 3. \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 React \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b7e\/f4f\/ac6\/b7ef4fac6228566522aa52c9ac633594.png\" alt=\"\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 React\/\" title=\"\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 React\/\" width=\"1050\" height=\"1050\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b7e\/f4f\/ac6\/b7ef4fac6228566522aa52c9ac633594.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b7e\/f4f\/ac6\/b7ef4fac6228566522aa52c9ac633594.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 React\/<\/figcaption><\/div>\n<\/figure>\n<p>\u0440\u0438\u04413.<\/p>\n<h3>Backend \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0439\u0447\u0430\u0441<\/h3>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u0430\u0445 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a  app.get(<code>\/api\/getCity<\/code>, cors(corsOptions), (req, res) =&gt; { } \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 server.js, \u0438 \u043e\u043d\u0430 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getCityList(), \u0440\u0438\u04411. \u0440\u0438\u04412.<\/p>\n<pre><code class=\"javascript\">app.get(`\/api\/getCity`, cors(corsOptions), (req, res) =&gt; {   console.log(\"You in Get - city\");     request.getCityList()     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); });<\/code><\/pre>\n<p>\u0440\u0438\u0441 1. <\/p>\n<pre><code class=\"javascript\">const getCityList = async (req, res) =&gt; {     try {         const response = await pool_weather.query(`SELECT * FROM tablecity`);         console.log(\"\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438  \u0432 getCityList!!\" + response.rows.length);           return response;     } catch (error) {         console.log(\"\u0447\u0442\u043e \u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u0432 getCityList!!\" + err.stack);         return res.status(500).send(error);     } };<\/code><\/pre>\n<p>\u0440\u0438\u0441 2.<\/p>\n<p>\u0418\u0437 \u043a\u043e\u0434\u0430 \u0432\u0438\u0434\u043d\u043e \u0447\u0442\u043e \u043d\u0435\u0442  &#8212; &#171;return new Promise(function (resolve, reject)&#187; \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e &#171;resolve(results.rows)&#187;, \u0438 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getCityList() \u0438\u043c\u0435\u044e\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 async, \u0435\u0441\u0442\u044c Promise \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442! \u041d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d Resolve, \u0430 \u043d\u0443\u0436\u0435\u043d await (\u0436\u0434\u0430\u0442\u044c) \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412 \u0438\u0442\u043e\u0433\u0435  \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 response \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>\u0427\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Promise.All) \u0438\u043b\u0438 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 (blockchain), \u043a\u0430\u043a \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Promise \u043d\u0430 <strong><em>Frontend<\/em><\/strong>.<\/p>\n<h2>\u0426\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 (&#171;blockchain), \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435  \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u0430\u043a \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0442\u0430\u043a \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0438  &#187;\u00a0Test Promice blockChain operathion!&#187; \u0440\u0438\u0441 1. ,\u0440\u0438\u0441 2. , \u0440\u0438\u0441 3.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eca\/25d\/636\/eca25d636eb95c45f20c07d1f408b789.png\" alt=\"\u041f\u043e\u0433\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043f\u0440\u043e\u0435\u043a\u0442)\" title=\"\u041f\u043e\u0433\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043f\u0440\u043e\u0435\u043a\u0442)\" width=\"2679\" height=\"1489\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/eca\/25d\/636\/eca25d636eb95c45f20c07d1f408b789.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eca\/25d\/636\/eca25d636eb95c45f20c07d1f408b789.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041f\u043e\u0433\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043f\u0440\u043e\u0435\u043a\u0442)<\/figcaption><\/div>\n<\/figure>\n<p>\u0440\u0438\u0441 1.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d5b\/930\/e00\/d5b930e009bcbc9a0d56f5819b91a593.png\" alt=\" \u0412\u044b\u0437\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \" title=\" \u0412\u044b\u0437\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \" width=\"2674\" height=\"1480\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d5b\/930\/e00\/d5b930e009bcbc9a0d56f5819b91a593.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d5b\/930\/e00\/d5b930e009bcbc9a0d56f5819b91a593.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption> <strong>\u0412\u044b\u0437\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/strong> <\/figcaption><\/div>\n<\/figure>\n<p>\u0440\u0438\u0441 2.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f39\/06f\/ef2\/f3906fef26666cdd4583a6669300a3c3.png\" alt=\"\u0424\u043e\u0440\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres.\" title=\"\u0424\u043e\u0440\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres.\" width=\"2610\" height=\"1479\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/f39\/06f\/ef2\/f3906fef26666cdd4583a6669300a3c3.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f39\/06f\/ef2\/f3906fef26666cdd4583a6669300a3c3.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0424\u043e\u0440\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres.<\/strong><\/figcaption><\/div>\n<\/figure>\n<p><strong>\u0440\u0438\u0441 3. <\/strong><\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres &#171;tablecity&#187; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442 &#171;cityname&#187;, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u0430 &#171;cityid&#187; \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0433\u043e \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b &#171;tableweather&#187; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0443\u043d\u043a\u0442\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442 &#171;cityid&#187;. \u0412\u0438\u0434 \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u0440\u0438\u0441 1.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39b\/ace\/310\/39bace310a54f07334d84cab497bec15.png\" alt=\"\u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres &quot;Weather2025&quot;.\" title=\"\u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres &quot;Weather2025&quot;.\" width=\"437\" height=\"1572\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/39b\/ace\/310\/39bace310a54f07334d84cab497bec15.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39b\/ace\/310\/39bace310a54f07334d84cab497bec15.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres &#171;Weather2025&#187;.<\/strong><\/figcaption><\/div>\n<\/figure>\n<p> \u0440\u0438\u0441 1.<\/p>\n<blockquote>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 API \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0432\u043e\u0442 \u0442\u0443\u0442 \u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438) \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (\u043f\u0440\u043e\u043c\u0438\u0441) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u0435\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f  \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430.<\/p>\n<p> \u041a\u0430\u0436\u0434\u044b\u0439 Promise \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c .then. \u041f\u0440\u0438\u043c\u0435\u0440 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0440\u0438\u0441 2.<\/p>\n<\/blockquote>\n<pre><code class=\"javascript\">new Promise(function(resolve, reject) {    setTimeout(() =&gt; resolve(1), 1000); \/\/ (*)  }).then(function(result) { \/\/ (**)    alert(result); \/\/ 1   return result * 2;  }).then(function(result) { \/\/ (***)    alert(result); \/\/ 2   return result * 2;  }).then(function(result) {    alert(result); \/\/ 4   return result * 2; <\/code><\/pre>\n<p>\u0418\u0434\u0435\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0438\u0441\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432\u00a0<code>.then<\/code>.  <\/p>\n<p>\u0412\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u00a0<code>promise.then<\/code>\u00a0\u0442\u043e\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u043c\u0438\u0441, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0451\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439\u00a0<code>.then<\/code>.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u043e\u043d\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u043c\u0438\u0441\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439\u00a0<code>.then<\/code>.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c .then(function(result)) \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e Fetch, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c await axios.get() \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 .then.<\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441 3. \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<pre><code class=\"javascript\">\/\/2025   blockChain = async (e) =&gt; {     e.preventDefault();     const cityName = e.target.elements.cityInp.value;     console.log('blockChain city - ' + cityName);     const resultCity = await axios.get(process.env.REACT_APP_API_URL_TableCity +       `${cityName}`).then((resultCity) =&gt; {         alert(\"func 1 \u043a\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0430 \" + resultCity.data.rows[0].cityid);         var cityid = resultCity.data.rows[0].cityid;         const resultWeather = axios.get(process.env.REACT_APP_API_URL_TableWeather +           `${cityid}`).then((resultWeather) =&gt; {             alert(\"func 2 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u041a  \" + resultWeather.data.rows[0].temperature);           });       });   }   \/\/2025<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f blockChain, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435  \u0440\u0438\u0441 3.  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 <strong>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u043c\u044b \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0440\u044f\u0434 API \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/strong>. \u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0442\u0430\u043a \u0440\u0438\u0441 4.<\/p>\n<pre><code class=\"javascript\">\/\/\/\/\/\/Blockchain \/\/\u043a\u043e\u0434 \u0432 server.js app.get(`\/api\/getTableWeather\/:cityid`, cors(corsOptions), (req, res) =&gt; {  \/\/ console.log(\"You in getTableWeather - city is tablecity\" + req.params.cityid);     request.getBlockWeatherByCityId(req)     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); });  app.get(`\/api\/getTableCity\/:city`, cors(corsOptions), (req, res) =&gt; {   \/\/console.log(\"You in getTableCity - city is tablecity\" + req.params.city);     request.getTableCity(req)     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); }); \/\/\u043a\u043e\u0434 \u0432 server.js  \/\/\u043a\u043e\u0434 \u0432 querys.js const getBlockWeatherByCityId = async (req,res) =&gt; {     console.log(\"\u043c\u044b \u0432 BlockChain getTableWeather\" + \"\u0413\u043e\u0440\u043e\u0434 \" + req.params.cityid);     try {         const res = await pool_weather.query(`SELECT cityid,temperature,         datetxt FROM tableweather WHERE cityid = $1`, [req.params.cityid]);         console.log(\" \u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b tableruweather  \" +         res.rows[0][\"cityid\"] + \" \" + res.rows[0][\"temperature\"]);     return res;     } catch (err) {         console.log(\"\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b!!\" + err.stack);     } };  const getTableCity = async (req, res) =&gt; {     \/\/console.log(\"\u043c\u044b \u0432 getTableCity\" + \"\u0413\u043e\u0440\u043e\u0434 \" + req.params.city);     try {         const res = await pool_weather.query(`SELECT cityid, cityname,          lat, lon, country FROM tablecity WHERE cityname = $1`, [req.params.city]);         console.log(\"\u0414\u0430\u043d\u043d\u044b\u0435 tablecity \" + res.rows[0][\"cityname\"] + \" \" +                                                    res.rows[0][\"cityid\"] );     return res;     } catch (err) {         console.log(\"\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b!!\" + err.stack);     }   }; \/\/\u043a\u043e\u0434 \u0432 querys.js<\/code><\/pre>\n<p>\u0440\u0438\u0441 4.<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u043e\u0440\u043c\u044b \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 &#171;InputFormBlockChain&#187;  \u0440\u0438\u0441 5,6.<\/p>\n<pre><code class=\"javascript\">                &lt;button                   className=\"btnStartAsync\"                   onClick={() =&gt; this.btnClickAsync(this.state.display_noneA)}                 &gt;                   Test Async paralell operathion!                 &lt;\/button&gt;                 &lt;button                   className=\"btnStartBlockChain\"                   onClick={() =&gt; this.btnClickBlockChain(this.state.display_noneB)}                 &gt;                   Test Promice blockChain operathion!                 &lt;\/button&gt;                 &lt;button                   className=\"btnStartAsync\"                   onClick={() =&gt; this.btnClickTest()}                 &gt;                   Test Operathion!                 &lt;\/button&gt;                   &lt;div style={{ marginLeft: \"15px\" }} className=\"Changing_data_async\"&gt;                 &lt;InputFormAsync                   methodAction={this.paralleAsync}                 &gt;                   Test Paralle Async                 &lt;\/InputFormAsync&gt;               &lt;\/div&gt;               &lt;div style={{ marginLeft: \"15px\" }} className=\"Changing_data_blockChain\"&gt;                 &lt;InputFormBlockChain                   methodAction={this.blockChain}                 &gt;                   Test BlockChain                 &lt;\/InputFormBlockChain&gt;               &lt;\/div&gt;<\/code><\/pre>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fcd\/824\/b86\/fcd824b8607e5878a206ce9e6b4b9494.png\" alt=\"\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" title=\"\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" width=\"566\" height=\"1151\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/fcd\/824\/b86\/fcd824b8607e5878a206ce9e6b4b9494.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fcd\/824\/b86\/fcd824b8607e5878a206ce9e6b4b9494.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong><\/figcaption><\/div>\n<\/figure>\n<p>\u0440\u0438\u0441 4. <\/p>\n<pre><code class=\"javascript\">import React from \"react\"; import \"bootstrap\/dist\/css\/bootstrap.min.css\"; const InputFormBlockChain= (props) =&gt; {      return(   &lt;form className=\"form-container-actions\" onSubmit={(e) =&gt; {     e.preventDefault();     props.methodAction(e);    }}&gt;                  &lt;label className=\"labelForm\" htmlFor=\"inputCity\"&gt;Fill it out before            clicking the button&lt;\/label&gt;         &lt;input className='selectData1' type='text' name='cityInp' placeholder={'City'}&gt;          &lt;\/input&gt;         &lt;br&gt;&lt;\/br&gt;                  &lt;button className=\"selectButtonAsync\"&gt;{props.children}&lt;\/button&gt;      &lt;\/form&gt; ) }; export default InputFormBlockChain;<\/code><\/pre>\n<p>\u0440\u0438\u0441 5.<\/p>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443, <strong><em>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a!. <\/em><\/strong>\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u0438\u0441 \u0432\u0435\u0440\u043d\u0443\u043b \u043a\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u043b \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u043e\u043c\u0438\u0441\u0443, \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u043b\u0441\u044f \u043e\u0442\u0431\u043e\u0440 (\u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0437\u044f\u0442\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u0442\u0440\u043e\u043a). <\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d6c\/ad3\/019\/d6cad30192bfe7a853feb8c1bbd5a711.png\" alt=\"\u0426\u0435\u043f\u043e\u0447\u043a\u0430 Promises (\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u0438\u0441 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b)\" title=\"\u0426\u0435\u043f\u043e\u0447\u043a\u0430 Promises (\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u0438\u0441 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b)\" width=\"2588\" height=\"492\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d6c\/ad3\/019\/d6cad30192bfe7a853feb8c1bbd5a711.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d6c\/ad3\/019\/d6cad30192bfe7a853feb8c1bbd5a711.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0426\u0435\u043f\u043e\u0447\u043a\u0430 Promises<\/strong> (\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u0438\u0441 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b)<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3a4\/0ad\/f49\/3a40adf49b7a6e6bb8fbe6c83d07a97c.png\" width=\"2633\" height=\"570\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/3a4\/0ad\/f49\/3a40adf49b7a6e6bb8fbe6c83d07a97c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3a4\/0ad\/f49\/3a40adf49b7a6e6bb8fbe6c83d07a97c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h2>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0421 \u0446\u0435\u043f\u043e\u0447\u043a\u043e\u0439 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u043e \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f API \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0443\u0442 \u0442\u043e \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u043c\u043e\u0449\u044c <strong>Promise.All, <\/strong>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u044f\u0434 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0438 \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c, \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f <strong>\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e!<\/strong><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f &#171;paralleAsync&#187; \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0438, \u0442\u0430\u043a\u0436\u0435 \u043a\u0430 \u044f \u043f\u043e\u044f\u0441\u043d\u044f\u043b \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eaa\/214\/988\/eaa2149889f1b17618a192e62b5b203c.png\" alt=\"\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439\" title=\"\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439\" width=\"2526\" height=\"556\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/eaa\/214\/988\/eaa2149889f1b17618a192e62b5b203c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eaa\/214\/988\/eaa2149889f1b17618a192e62b5b203c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/strong><\/figcaption><\/div>\n<\/figure>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>\u041d\u0430 \u0440\u0438\u0441 1. \u0444\u0443\u043d\u043a\u0446\u0438\u044f  &#171;paralleAsync&#187; \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u00a0const [res, res2] = await <strong>Promise.all<\/strong>([datacity(city), dataweather(city)]), \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438  datacity(city) \u0438 dataweather(city) \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446 &#171;datacity&#187; \u0438 &#171;tableruweather&#187;. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 res \u0438 res2.<\/p>\n<pre><code class=\"javascript\">\/\/Test parallel load city and weather   paralleAsync = async (e) =&gt; {     e.preventDefault();     const city = e.target.elements.cityInp.value;     \/\/console.log('paralleBlockChain city - ' + city);      const datacity = async (city) =&gt; {       try {         const res = await axios.get(process.env.REACT_APP_API_URL_TableCity + `${city}`);         \/\/ alert(\"func 1 data \", res.data.rows[0]);         return res;       } catch (err) {         console.log('Error city' + err);       }      }      const dataweather = async (city) =&gt; {       try {         const res2 = await axios.get(process.env.REACT_APP_API_URL_TableWeatherRu + `${city}`);         \/\/alert(\"func 2 data\", res2.data.rows[0].temperature);         return res2;       } catch (err) {         console.log('Error weather_ru' + err);       }     }      const [res, res2] = await Promise.all([datacity(city), dataweather(city)]);     \/\/console.log('\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446 Promise.all ' + res.data.rows[0].cityid + '  ' + res2.data.rows[0].temperature);     alert('\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446 \u043a\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0430  ' + res.data.rows[0].cityid + ' \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0421 ' + res2.data.rows[0].temperature)    }<\/code><\/pre>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0438\u0441 1. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0445 \u0432 Promise.All<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/83a\/0c2\/64c\/83a0c264c349f07abb2f36e1a15ad9a3.png\" alt=\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Promise.all\" title=\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Promise.all\" width=\"2508\" height=\"562\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/83a\/0c2\/64c\/83a0c264c349f07abb2f36e1a15ad9a3.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/83a\/0c2\/64c\/83a0c264c349f07abb2f36e1a15ad9a3.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Promise.all<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u043e\u0434\u0432\u0435\u0434\u044f \u0438\u0442\u043e\u0433\u043e \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0438\u0437\u043b\u043e\u0436\u0438\u043b \u0432\u044b\u0448\u0435, \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 JavaScript c \u0444\u043e\u043d\u043e\u0432\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 1\u0421. \u042f \u0443\u0436\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u043e &#171;\u0414\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u043c \u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c&#187; \u0438 \u0433\u043e\u0442\u043e\u0432\u043b\u044e \u043d\u043e\u0432\u0443\u044e \u0441 \u0437\u0430\u043c\u0435\u0440\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u043c\u0438 \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u044f\u043c\u0438. \u0412 1\u0421 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044d\u0442\u043e \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0435\u0441\u044f \u0432 \u0444\u043e\u043d\u0435 (\u0442\u043e\u0442 \u0436\u0435  async await) \u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u043e\u0442\u043e\u043a\u0430\u043c (\u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0447\u0442\u043e Promice.All) \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u0445 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u0432\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e! \u043a\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043d\u0430 \u043a\u043e\u043c\u0443 \u0442\u043e \u0432 \u0447\u0435\u043c \u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442, \u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043d\u0430 1\u0421, \u044f \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u044e \u0432 \u043a\u043e\u0434 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f &#171;\u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438&#187;. \u041d\u043e \u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 JavaScript \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 React \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438 \u043e\u043d\u0430 \u0432\u0435\u0437\u0434\u0435 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>\u0414\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447 \u043d\u0430 Habr \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0441\u0435\u043c \u043a\u0442\u043e \u044d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f!<\/p>\n<p><strong>SPS. <\/strong>Lipetsk 2025\u0433.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 &#171;Weather&#187; \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0430\u0441\u044c \u0442\u0435\u043c\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432  \u0440\u0438\u0441 . \u043d\u0438\u0436\u0435<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e9\/50d\/b20\/5e950db205e39882864cad2d829432cd.png\" alt=\"\u0440\u0438\u04411. (\u0412\u044b\u0431\u043e\u0440 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432)\" title=\"\u0440\u0438\u04411. (\u0412\u044b\u0431\u043e\u0440 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432)\" width=\"2175\" height=\"1166\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5e9\/50d\/b20\/5e950db205e39882864cad2d829432cd.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e9\/50d\/b20\/5e950db205e39882864cad2d829432cd.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0440\u0438\u04411. (\u0412\u044b\u0431\u043e\u0440 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432)<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ab\/e5d\/fde\/9abe5dfdee241da898ad6a7f973eee87.png\" alt=\"\u0420\u0438\u04412. \u0412\u044b\u0431\u043e\u0440 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430\" title=\"\u0420\u0438\u04412. \u0412\u044b\u0431\u043e\u0440 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430\" width=\"2114\" height=\"1685\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9ab\/e5d\/fde\/9abe5dfdee241da898ad6a7f973eee87.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ab\/e5d\/fde\/9abe5dfdee241da898ad6a7f973eee87.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0420\u0438\u04412. \u0412\u044b\u0431\u043e\u0440 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/589\/7d0\/e1c\/5897d0e1c4b73d60e70b39472eb77524.png\" alt=\"\u0420\u0438\u04413. \u0422\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430.\" title=\"\u0420\u0438\u04413. \u0422\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430.\" width=\"2105\" height=\"1198\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/589\/7d0\/e1c\/5897d0e1c4b73d60e70b39472eb77524.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/589\/7d0\/e1c\/5897d0e1c4b73d60e70b39472eb77524.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0420\u0438\u04413. \u0422\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430.<\/figcaption><\/div>\n<\/figure>\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\/910462\/\"> https:\/\/habr.com\/ru\/articles\/910462\/<\/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<figure class=\"full-width\">\n<div><figcaption>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 JavaScript<\/figcaption><\/div>\n<\/figure>\n<h2>\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0431 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0430\u044f \u043a\u043e\u0433\u0434\u0430 \u0438\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u0438\u0434\u0435\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0427\u0442\u043e \u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u0434\u0443 \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c?. \u041a\u043e\u0433\u0434\u0430 \u044f 2022 \u0433. \u0443\u0432\u043b\u0435\u043a\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043d\u0430 React (\u044d\u0442\u043e JavaScript \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430) \u0438 \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u0439\u0442 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u0433\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f OpenWeatherMap, \u043f\u0435\u0440\u0432\u043e\u0435 \u0441 \u0447\u0435\u043c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043f\u043e \u0442\u0435\u043c\u0435 \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0438\u0448\u0443 \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 promise.<\/p>\n<h2>Promise<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044d\u0442\u043e \u043e\u0431\u0435\u0449\u0430\u0442\u044c, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043a \u0438 \u043e\u0448\u0438\u0431\u043a\u0430. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u0432\u0435\u0437\u0434\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u043e promise. \u042f \u043d\u0435\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u0430 \u0438 \u0441\u043a\u0430\u0436\u0435\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u0434\u0435 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c Promise.All() \u043e\u0431 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0438 \u043a\u0430\u043a \u043f\u0438\u0448\u0443 \u043a\u043e\u0434 \u0441\u0435\u0439\u0447\u0430\u0441.<\/p>\n<h3>Backend \u043a\u0430\u043a \u0431\u044b\u043b\u043e<\/h3>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b &#171;tableweather&#187; \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 PostgresSQL c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#171;getWeather&#187; \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0439 \u0432 Promise.<\/p>\n<pre><code class=\"javascript\">const getWeather = async (req, res) =&gt; {      return new Promise(function (resolve, reject) {         pool_weather.query(`SELECT * FROM tableweather`, (error, results) =&gt; {             if (error) {                 reject(error);             }             resolve(results.rows);         });     }); };<\/code><\/pre>\n<p>\u0423 Promise \u0435\u0441\u0442\u044c <strong><em>resolve<\/em><\/strong>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 <strong><em>reject<\/em><\/strong> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u0431\u044d\u043a\u0438. Result (&#171;\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442&#187;)  &#8212; \u0432\u043d\u0430\u0447\u0430\u043b\u0435\u00a0undefined, \u0434\u0430\u043b\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u00a0value\u00a0\u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u00a0resolve(value)\u00a0\u0438\u043b\u0438 \u043d\u0430\u00a0error\u00a0\u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u00a0reject(error).  \u041d\u0430\u0432\u0435\u0440\u043d\u043e \u0443 \u043a\u043e\u0433\u043e \u0442\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u0430 \u043f\u0440\u0438\u0447\u0435\u043c \u0437\u0434\u0435\u0441\u044c &#187;Backend&#187; ? \u041d\u0430 \u043d\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0438\u0436\u0435 \u0440\u0438\u04412. \u0424\u0443\u043d\u043a\u0446\u0438\u044e &#171;getWeather&#187; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f &#171;&#187;\/api\/getAllWeather&#187; \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 server.js \u0440\u0438\u04413. \u0413\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440  &#8212; Express.<\/p>\n<pre><code class=\"javascript\">app.get(`\/api\/getAllWeather`, cors(corsOptions), (req, res) =&gt; {   console.log(\"Weather in all - city\");     request.getWeather()     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); });<\/code><\/pre>\n<p>\u0440\u0438\u0441 2.<\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441 3. \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 React \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 React\/<\/figcaption><\/div>\n<\/figure>\n<p>\u0440\u0438\u04413.<\/p>\n<h3>Backend \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0439\u0447\u0430\u0441<\/h3>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u0430\u0445 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a  app.get(<code>\/api\/getCity<\/code>, cors(corsOptions), (req, res) =&gt; { } \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 server.js, \u0438 \u043e\u043d\u0430 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getCityList(), \u0440\u0438\u04411. \u0440\u0438\u04412.<\/p>\n<pre><code class=\"javascript\">app.get(`\/api\/getCity`, cors(corsOptions), (req, res) =&gt; {   console.log(\"You in Get - city\");     request.getCityList()     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); });<\/code><\/pre>\n<p>\u0440\u0438\u0441 1. <\/p>\n<pre><code class=\"javascript\">const getCityList = async (req, res) =&gt; {     try {         const response = await pool_weather.query(`SELECT * FROM tablecity`);         console.log(\"\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438  \u0432 getCityList!!\" + response.rows.length);           return response;     } catch (error) {         console.log(\"\u0447\u0442\u043e \u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u0432 getCityList!!\" + err.stack);         return res.status(500).send(error);     } };<\/code><\/pre>\n<p>\u0440\u0438\u0441 2.<\/p>\n<p>\u0418\u0437 \u043a\u043e\u0434\u0430 \u0432\u0438\u0434\u043d\u043e \u0447\u0442\u043e \u043d\u0435\u0442  &#8212; &#171;return new Promise(function (resolve, reject)&#187; \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e &#171;resolve(results.rows)&#187;, \u0438 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getCityList() \u0438\u043c\u0435\u044e\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 async, \u0435\u0441\u0442\u044c Promise \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442! \u041d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d Resolve, \u0430 \u043d\u0443\u0436\u0435\u043d await (\u0436\u0434\u0430\u0442\u044c) \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412 \u0438\u0442\u043e\u0433\u0435  \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 response \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>\u0427\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Promise.All) \u0438\u043b\u0438 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 (blockchain), \u043a\u0430\u043a \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Promise \u043d\u0430 <strong><em>Frontend<\/em><\/strong>.<\/p>\n<h2>\u0426\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 (&#171;blockchain), \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435  \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u0430\u043a \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0442\u0430\u043a \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0438  &#187;\u00a0Test Promice blockChain operathion!&#187; \u0440\u0438\u0441 1. ,\u0440\u0438\u0441 2. , \u0440\u0438\u0441 3.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u043e\u0433\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043f\u0440\u043e\u0435\u043a\u0442)<\/figcaption><\/div>\n<\/figure>\n<p>\u0440\u0438\u0441 1.<\/p>\n<figure class=\"full-width\">\n<div><figcaption> <strong>\u0412\u044b\u0437\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/strong> <\/figcaption><\/div>\n<\/figure>\n<p>\u0440\u0438\u0441 2.<\/p>\n<figure class=\"full-width\">\n<div><figcaption><strong>\u0424\u043e\u0440\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres.<\/strong><\/figcaption><\/div>\n<\/figure>\n<p><strong>\u0440\u0438\u0441 3. <\/strong><\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres &#171;tablecity&#187; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442 &#171;cityname&#187;, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u0430 &#171;cityid&#187; \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0433\u043e \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b &#171;tableweather&#187; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0443\u043d\u043a\u0442\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442 &#171;cityid&#187;. \u0412\u0438\u0434 \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u0440\u0438\u0441 1.<\/p>\n<figure class=\"\">\n<div><figcaption><strong>\u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgres &#171;Weather2025&#187;.<\/strong><\/figcaption><\/div>\n<\/figure>\n<p> \u0440\u0438\u0441 1.<\/p>\n<blockquote>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 API \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0432\u043e\u0442 \u0442\u0443\u0442 \u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438) \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (\u043f\u0440\u043e\u043c\u0438\u0441) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u0435\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f  \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430.<\/p>\n<p> \u041a\u0430\u0436\u0434\u044b\u0439 Promise \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c .then. \u041f\u0440\u0438\u043c\u0435\u0440 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0440\u0438\u0441 2.<\/p>\n<\/blockquote>\n<pre><code class=\"javascript\">new Promise(function(resolve, reject) {    setTimeout(() =&gt; resolve(1), 1000); \/\/ (*)  }).then(function(result) { \/\/ (**)    alert(result); \/\/ 1   return result * 2;  }).then(function(result) { \/\/ (***)    alert(result); \/\/ 2   return result * 2;  }).then(function(result) {    alert(result); \/\/ 4   return result * 2; <\/code><\/pre>\n<p>\u0418\u0434\u0435\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0438\u0441\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432\u00a0<code>.then<\/code>.  <\/p>\n<p>\u0412\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u00a0<code>promise.then<\/code>\u00a0\u0442\u043e\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u043c\u0438\u0441, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0451\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439\u00a0<code>.then<\/code>.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u043e\u043d\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u043c\u0438\u0441\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439\u00a0<code>.then<\/code>.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c .then(function(result)) \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e Fetch, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c await axios.get() \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 .then.<\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441 3. \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<pre><code class=\"javascript\">\/\/2025   blockChain = async (e) =&gt; {     e.preventDefault();     const cityName = e.target.elements.cityInp.value;     console.log('blockChain city - ' + cityName);     const resultCity = await axios.get(process.env.REACT_APP_API_URL_TableCity +       `${cityName}`).then((resultCity) =&gt; {         alert(\"func 1 \u043a\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0430 \" + resultCity.data.rows[0].cityid);         var cityid = resultCity.data.rows[0].cityid;         const resultWeather = axios.get(process.env.REACT_APP_API_URL_TableWeather +           `${cityid}`).then((resultWeather) =&gt; {             alert(\"func 2 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u041a  \" + resultWeather.data.rows[0].temperature);           });       });   }   \/\/2025<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f blockChain, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435  \u0440\u0438\u0441 3.  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 <strong>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u043c\u044b \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0440\u044f\u0434 API \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/strong>. \u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0442\u0430\u043a \u0440\u0438\u0441 4.<\/p>\n<pre><code class=\"javascript\">\/\/\/\/\/\/Blockchain \/\/\u043a\u043e\u0434 \u0432 server.js app.get(`\/api\/getTableWeather\/:cityid`, cors(corsOptions), (req, res) =&gt; {  \/\/ console.log(\"You in getTableWeather - city is tablecity\" + req.params.cityid);     request.getBlockWeatherByCityId(req)     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); });  app.get(`\/api\/getTableCity\/:city`, cors(corsOptions), (req, res) =&gt; {   \/\/console.log(\"You in getTableCity - city is tablecity\" + req.params.city);     request.getTableCity(req)     .then((response) =&gt; {       res.status(200).send(response);     })     .catch((error) =&gt; {       res.status(500).send(error);     }); }); \/\/\u043a\u043e\u0434 \u0432 server.js  \/\/\u043a\u043e\u0434 \u0432 querys.js const getBlockWeatherByCityId = async (req,res) =&gt; {     console.log(\"\u043c\u044b \u0432 BlockChain getTableWeather\" + \"\u0413\u043e\u0440\u043e\u0434 \" + req.params.cityid);     try {         const res = await pool_weather.query(`SELECT cityid,temperature,         datetxt FROM tableweather WHERE cityid = $1`, [req.params.cityid]);         console.log(\" \u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b tableruweather  \" +         res.rows[0][\"cityid\"] + \" \" + res.rows[0][\"temperature\"]);     return res;     } catch (err) {         console.log(\"\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b!!\" + err.stack);     } };  const getTableCity = async (req, res) =&gt; {     \/\/console.log(\"\u043c\u044b \u0432 getTableCity\" + \"\u0413\u043e\u0440\u043e\u0434 \" + req.params.city);     try {         const res = await pool_weather.query(`SELECT cityid, cityname,          lat, lon, country FROM tablecity WHERE cityname = $1`, [req.params.city]);         console.log(\"\u0414\u0430\u043d\u043d\u044b\u0435 tablecity \" + res.rows[0][\"cityname\"] + \" \" +                                                    res.rows[0][\"cityid\"] );     return res;     } catch (err) {         console.log(\"\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b!!\" + err.stack);     }   }; \/\/\u043a\u043e\u0434 \u0432 querys.js<\/code><\/pre>\n<p>\u0440\u0438\u0441 4.<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u043e\u0440\u043c\u044b \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 &#171;InputFormBlockChain&#187;  \u0440\u0438\u0441 5,6.<\/p>\n<pre><code class=\"javascript\">                &lt;button                   className=\"btnStartAsync\"                   onClick={() =&gt; this.btnClickAsync(this.state.display_noneA)}                 &gt;                   Test Async paralell operathion!                 &lt;\/button&gt;                 &lt;button                   className=\"btnStartBlockChain\"                   onClick={() =&gt; this.btnClickBlockChain(this.state.display_noneB)}                 &gt;                   Test Promice blockChain operathion!                 &lt;\/button&gt;                 &lt;button                   className=\"btnStartAsync\"                   onClick={() =&gt; this.btnClickTest()}                 &gt;                   Test Operathion!                 &lt;\/button&gt;                   &lt;div <\/code><\/pre>\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-461016","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/461016","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=461016"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/461016\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=461016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=461016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=461016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}