{"id":294309,"date":"2019-09-05T15:00:29","date_gmt":"2019-09-05T15:00:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=294309"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=294309","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ONLYOFFICE DocumentBuilder"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i8\/j3\/kd\/i8j3kdtzriyrkwbhkbqbbpozbik.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440. <\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u0443\u0442\u0438\u043b\u0438\u0442\u0435 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c DocumentBuilder, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u044e\u043c\u0435 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0438\u043b\u0434\u0435\u0440 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043a\u043e\u0434 \u043d\u0430 js, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043e\u0442\u0434\u0430\u0435\u0442\u0435 \u0435\u0433\u043e \u0443\u0442\u0438\u043b\u0438\u0442\u0435, \u0430 \u043e\u043d\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442. \u0418\u043b\u0438 \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u043b\u0434\u0435\u0440 \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044f\u043c\u0438, \u0438\u043b\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li>\u041d\u0443\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0441\u0435\u0440\u0432\u0438\u0441.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u044e\u043c\u0435: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u043e\u043b\u044f, \u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0438 \u043e\u0442\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u042d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u043b\u0434\u0435\u0440. <\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Node.js (express).<\/p>\n<p>  <\/p>\n<p>\u041f\u043b\u0430\u043d:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0443 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0444\u043e\u0440\u043c\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/li>\n<li>\u041d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 Node.js \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0431\u0438\u043b\u0434\u0435\u0440\u0430.<\/li>\n<li>Node.js \u043e\u0442\u0434\u0430\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0438\u043b\u0434\u0435\u0440\u0443.<\/li>\n<li>\u0411\u0438\u043b\u0434\u0435\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442.<\/li>\n<li>Node.js \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"sozdanie-formy\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u043e\u0440\u043c\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412 \u0444\u043e\u0440\u043c\u0435 \u0431\u0443\u0434\u0435\u0442 8 \u043f\u043e\u043b\u0435\u0439: \u00abFull name\u00bb, \u00abPhone number\u00bb, \u00abemail\u00bb, \u00abprofile\u00bb, \u00abdegree\u00bb, \u00abuniversity\u00bb, \u00ablocation\u00bb, \u00abyear\u00bb, \u00abskill\u00bb. \u041f\u043e\u043b\u0435 skill \u043c\u043e\u0436\u043d\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b index.html, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u043a\u043e\u0434 \u0448\u0430\u0431\u043b\u043e\u043d\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;div class=\"fill-name\"&gt;     &lt;input type=\"text\" id=\"fill-name\" placeholder=\"full name\"&gt; &lt;\/div&gt;  &lt;div class=\"phone-number\"&gt;     &lt;input type=\"number\" id=\"phone-number\" placeholder=\"phone number\"&gt; &lt;\/div&gt;  &lt;div class=\"email\"&gt;     &lt;input type=\"text\" id=\"email\" placeholder=\"email\"&gt; &lt;\/div&gt;  &lt;div class=\"profile\"&gt;     &lt;textarea id=\"profile\" placeholder=\"Insert a brief description of yourself\"&gt;&lt;\/textarea&gt; &lt;\/div&gt;  &lt;div class=\"education\"&gt;     &lt;input type=\"text\" id=\"degree\" placeholder=\"degree\"&gt;     &lt;input type=\"text\" id=\"university\" placeholder=\"university\"&gt;     &lt;input type=\"text\" id=\"location\" placeholder=\"location\"&gt;     &lt;input type=\"date\" id=\"year\" placeholder=\"year\"&gt; &lt;\/div&gt;  &lt;div class=\"skills\"&gt;     &lt;div class=\"skill\"&gt;         &lt;input type=\"text\" id=\"new-skill\" placeholder=\"skill\" onkeyup=\"add_skill_by_enter(event)\"&gt;         &lt;button onclick=\"add_skill()\"&gt;+&lt;\/button&gt;     &lt;\/div&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 add_skill_by_enter(event) \u0438 add_skill(). \u041e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0439 \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438 + \u0438\u043b\u0438 Enter. \u0421\u0430\u043c\u0438 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u043f\u0438\u0448\u0443 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;button onclick=\"sendForm()\"&gt;Send&lt;\/button&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u043e\u0440\u043c\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u2014 add_skill()<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">add_skill = () =&gt; {     const newSkill = document.getElementById(\"new-skill\");     if (newSkill.value === '') {return; } \/\/ \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c, \u0435\u0441\u043b\u0438 \u0432 \u043f\u043e\u043b\u0435 \u043d\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435     const div = document.createElement(\"div\"); .\/\/\u0432\u043d\u0435\u0448\u043d\u0438\u0439 div     const span = document.createElement(\"span\");  \/\/ \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0432\u044b\u043a\u0430     const button = document.createElement(\"button\"); \/\/ \u043a\u043d\u043e\u043f\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0432\u044b\u043a\u0430     span.innerText += newSkill.value; \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 span \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442     newSkill.value = ''; \/\/ \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0435 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438     newSkill.focus(); \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0444\u043e\u043a\u0443\u0441 \u0432 \u043f\u043e\u043b\u0435 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0430\u0432\u044b\u043a\u0430     button.innerText += \"-\";     button.onclick = () =&gt; {  \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f     div.remove(); }; div.appendChild(span); \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c span \u0432 div div.appendChild(button); \/\/\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f document.getElementsByClassName('skills')[0].appendChild(div); \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 }; add_skill_by_enter()   add_skill_by_enter = (event) =&gt; {         if (event.code === \"Enter\") { \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u043b\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 enter             add_skill();         }     };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u043e\u043b\u0435\u0439 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">    get_skill_values = () =&gt; {         const skills = [];         if (document.getElementById('new-skill').value !== '') {             skills.push(document.getElementById('new-skill').value);         }         Array.from(document.getElementsByClassName('skillfield')).forEach(current_element =&gt; {             skills.push(current_element.innerHTML);         });         return skills;     }; sendForm()     sendForm = () =&gt; {         fetch('\/', {             method: 'POST',             headers: {                 'Content-Type': 'application\/json'             },             body: JSON.stringify({                 userData: {                     fillName: document.getElementById('fill-name').value,                     phoneNumber: document.getElementById('phone-number').value,                     email: document.getElementById('email').value,                     profile: document.getElementById('profile').value,                     education: {                         degree: document.getElementById('degree').value,                         university: document.getElementById('university').value,                         location: document.getElementById('location').value,                         year: document.getElementById('year').value,                     },                     skills: get_skill_values()                 }             })         }).then(res =&gt; res.json())             .then(response =&gt; {                 location.replace('\/' + response.filename); \/\/ \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435             })             .catch(error =&gt; console.error('Error:', error));     };<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"servernaya-chast-dlya-raboty-s-formoy\">\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u043e\u0440\u043c\u043e\u0439<\/h2>\n<p>  <\/p>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0438\u0448\u0443 \u043d\u0430 express. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 get \u0438 post \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const path = require('path'); const express = require('express'); const bodyParser = require('body-parser'); const app = express();  app.use(bodyParser.json());  app.get('\/', (req, res) =&gt; {     res.sendFile(path.join(__dirname + '\/index.html')); });  app.post('\/', (req, res) =&gt; {     \/\/ \u0441\u044e\u0434\u0430 \u0434\u043e\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0442\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 });  app.listen(3000, () =&gt; console.log(`Example app listening on port ${3000}!`));<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c express:<br \/>  <code>node main.js<\/code><\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0430\u0434\u0440\u0435c:<br \/>  <code>http:localhost:3000<\/code><\/p>\n<p>  <\/p>\n<p>\u0412\u0438\u0434\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443. \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v9\/qo\/sq\/v9qosqh3l4ppxfrt-zulcv1fyce.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 json:<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">{\"userData\":{\"fillName\":\"Rotatyy Dmitryi\",\"phoneNumber\":\"89879879898\",\"email\":\"flamine@list.ru\",\"profile\":\"Hi, my name is Joe\\nAnd I work in a button factory\\nI got a wife and two kids\\nOne day, my boss says, \u201cJoe, are you busy?\u201d\\nI said, \u201cno\u201d\\n\u201cThen push this button with your right hand\u201d\",\"country\":\"Russia\",\"city\":\"Nizhniy Novgorod\",\"education\":{\"degree\":\"Master of Pupets\",\"university\":\"Nizhny novgorod state technical university\",\"location\":\"Nizhniy Novgorod\",\"year\":\"2015-05-02\"},\"skills\":[\"apple.js\",\"vintage.js\",\"zerg.js\",\"css\",\"html\",\"linux\"]}};<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0431\u0438\u043b\u0434\u0435\u0440\u0430. \u042f \u0432\u0437\u044f\u043b \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Google Docs (\u0448\u0430\u0431\u043b\u043e\u043d \u0440\u0435\u0437\u044e\u043c\u0435). <\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0442\u0430\u043a:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0a0\/488\/bbe\/0a0488bbe082407d850b2fe37bd5704f.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0438\u043b\u0434\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0438 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 \u044d\u0442\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c desktop-\u0432\u0435\u0440\u0441\u0438\u044e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432 ONLYOFFICE \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0430\u043a\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0430\u043d\u043d\u044b\u0435. \u0410 \u043f\u043e\u0442\u043e\u043c \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a \u043c\u0430\u043a\u0440\u043e\u0441\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0431\u0438\u043b\u0434\u0435\u0440\u0430. \u042d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0438 \u0431\u0438\u043b\u0434\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 API.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/0n\/qo\/ee\/0nqoeewn2so-cv6gvwwdlvpywls.png\"><\/p>\n<p>  <\/p>\n<h2 id=\"sozdanie-skripta-dlya-bildera\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0431\u0438\u043b\u0434\u0435\u0440\u0430<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const Document = Api.GetDocument(); const data =   {\"userData\":{\"fillName\":\"Rotatyy Dmitryi\",\"phoneNumber\":\"89879879898\",\"email\":\"flamine@list.ru\",\"profile\":\"Hi, my name is Joe\\nAnd I work in a button factory\\nI got a wife and two kids\\nOne day, my boss says, \u201cJoe, are you busy?\u201d\\nI said, \u201cno\u201d\\n\u201cThen push this button with your right hand\u201d\",\"country\":\"Russia\",\"city\":\"Nizhniy Novgorod\",\"education\":{\"degree\":\"Master of Pupets\",\"university\":\"Nizhny novgorod state technical university\",\"location\":\"Nizhniy Novgorod\",\"year\":\"2015-05-02\"},\"skills\":[\"apple.js\",\"vintage.js\",\"zerg.js\",\"css\",\"html\",\"linux\"]}};<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444 \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d 14 \u0448\u0440\u0438\u0444\u0442\u043e\u043c, \u0436\u0438\u0440\u043d\u044b\u043c, \u0438 \u0443 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444\u0430 line spacing \u0440\u0430\u0432\u0435\u043d 1.15.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">let paragraph = document.GetElement(0); \/\/ \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444 FullName_style = Document.CreateStyle(\"FullName\"); \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u0438\u043b\u044c FullName_style.GetTextPr().SetFontSize(28); \/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430 FullName_style.GetTextPr().SetBold(true); \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c bold paragraph.SetStyle(FullName_style); \/\/ \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u043a \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444\u0443 paragraph.SetSpacingLine(1.15 * 240, \"auto\"); \/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u043c\u0435\u0436\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b paragraph.AddText(data.userData.fillName);  \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u0433\u0440\u0430\u0444\u044b:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">\/\/ Country and city const CountryCity_style = Document.CreateStyle(\"CountryCity\"); CountryCity_style.GetTextPr().SetFontSize(20); CountryCity_style.GetTextPr().SetCaps(true); CountryCity_style.GetTextPr().SetBold(true); paragraph = Api.CreateParagraph(); paragraph.AddText(data.userData.country + ', ' + data.userData.city); paragraph.SetStyle(CountryCity_style); paragraph.SetSpacingAfter(0); Document.Push(paragraph);  \/\/ phone number const PhoneNumber_style = Document.CreateStyle(\"PhoneNumber\"); PhoneNumber_style.GetTextPr().SetFontSize(20); PhoneNumber_style.GetParaPr().SetSpacingAfter(0); PhoneNumber_style.GetTextPr().SetBold(true); paragraph = Api.CreateParagraph(); paragraph.AddText(data.userData.phoneNumber); paragraph.SetStyle(PhoneNumber_style); Document.Push(paragraph);  \/\/ email const Email_style = Document.CreateStyle(\"Email\"); Email_style.GetTextPr().SetFontSize(18); Email_style.GetParaPr().SetSpacingAfter(0); Email_style.GetTextPr().SetBold(true); paragraph = Api.CreateParagraph(); paragraph.AddText(data.userData.email); paragraph.SetStyle(Email_style); Document.Push(paragraph);  \/\/ SectionHeader style const SectionHeader = Document.CreateStyle(\"SectionHeader\"); SectionHeader.GetTextPr().SetBold(true); SectionHeader.GetTextPr().SetColor(247, 93, 93, false); SectionHeader.GetTextPr().SetFontSize(28); SectionHeader.GetParaPr().SetSpacingBefore(1.33 * 240); SectionHeader.GetParaPr().SetSpacingLine(1 * 240, \"auto\");  \/\/ add header Profile: paragraph = Api.CreateParagraph(); paragraph.AddText(\"Profile:\") paragraph.SetStyle(SectionHeader); Document.Push(paragraph);  \/\/ add profile text: paragraph = Api.CreateParagraph(); paragraph.AddText(data.userData.profile) Document.Push(paragraph);  \/\/ add header Education: paragraph = Api.CreateParagraph(); paragraph.AddText(\"Education:\") paragraph.SetStyle(SectionHeader); Document.Push(paragraph);  \/\/ add education year: const EducationYear_style = Document.CreateStyle(\"EducationYear\"); EducationYear_style.GetTextPr().SetColor(102, 102, 102); EducationYear_style.GetTextPr().SetFontSize(18); EducationYear_style.GetParaPr().SetSpacingAfter(0); paragraph = Api.CreateParagraph(); paragraph.SetStyle(EducationYear_style); paragraph.AddText(data.userData.education.year) Document.Push(paragraph);  \/\/ add education university: paragraph = Api.CreateParagraph();  run = Api.CreateRun(); run.AddText(data.userData.education.university) run.AddText(', ') run.AddText(data.userData.education.location) run.SetBold(true); paragraph.AddElement(run); run = Api.CreateRun(); run.AddText(' \u2013 ' + data.userData.education.degree) paragraph.AddElement(run); Document.Push(paragraph);  \/\/ add header Skills: paragraph = Api.CreateParagraph(); paragraph.AddText(\"Skills:\") paragraph.SetStyle(SectionHeader); Document.Push(paragraph);  \/\/ add skills text: paragraph = Api.CreateParagraph(); const skills = data.userData.skills.map(x =&gt; ' ' + x).toString(); paragraph.AddText(skills) Document.Push(paragraph);<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0432 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jt\/bu\/c3\/jtbuc3bitzmanxfyvddrmrohi_8.png\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0434\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. <\/p>\n<p>  <\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 -&gt; \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0444\u0430\u0439\u043b -&gt; \u043e\u0442\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0431\u0438\u043b\u0434\u0435\u0440\u0443 -&gt; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b.<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Node.js, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u00abpublic\u00bb \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const {exec} = require('child_process'); const fs = require('fs'); app.use(express.static('public'));<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 \u043e\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043e \u0432\u0441\u0435\u043c \u043a\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u0431\u0438\u043b\u0434\u0435\u0440\u0430, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u0430\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0438\u043d\u0430\u0447\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">generate_script = (data) =&gt; {     let first_template = 'builder.CreateFile(\"docx\");\\n' +         'const Document = Api.GetDocument();\\n';     first_template += 'const data = ' + JSON.stringify(data) + ';\\n';     first_template += 'let paragraph = Document.GetElement(0);\\n' +         'FullName_style = Document.CreateStyle(\"FullName\");\\n' + .... \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434 ~~~~~~~~~~~     return first_template; };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u0444\u0430\u0439\u043b \u0438 \u043e\u0442\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u0438\u043b\u0434\u0435\u0440\u0443. \u041f\u043e \u0441\u0443\u0442\u0438, \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0438\u043b\u0434\u0435\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>documentbuilder path\/script.js \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Node.js<\/code><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e build, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">build = (data, res) =&gt; {     const filename = Math.random().toString(36).substring(7) + '.docx'; \/\/ \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430      let script = generate_script(data);     script += 'builder.SaveFile(\"docx\", \"' + __dirname + '\/public\/' + filename + '\");\\n' + 'builder.CloseFile();';     fs.writeFile('public\/' + filename + 'js', script, () =&gt; {         exec('documentbuilder ' + 'public\/' + filename + 'js', () =&gt; { res.send({'filename': filename }); });     }); };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 build(req.body, res); \u043f\u0440\u0438 post \u0437\u0430\u043f\u0440\u043e\u0441\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">app.post('\/', (req, res) =&gt; {     build(req.body, res); });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e. \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b <a href=\"https:\/\/github.com\/no-flamine\/documentbuilder-integration-example-nodejs\">\u0441\u044e\u0434\u0430<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c ONLYOFFICE DocumentBuilder \u0432 web-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0439, \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0425\u043e\u0442\u0435\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u043e\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0435\u0441\u0442\u044c \u043c\u044b\u0441\u043b\u0438 \u0434\u043e\u043f\u0438\u043b\u0438\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0441\u043f\u0435\u043a\u0442\u0440 \u0440\u0435\u0448\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0411\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u0435\u0439\u0441\u0430\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u043d\u0443 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u043e\u0436\u0435) \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0438\u043b\u0438 \u0432 \u043b\u0438\u0447\u043a\u0435.<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/466217\/\"> https:\/\/habr.com\/ru\/post\/466217\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i8\/j3\/kd\/i8j3kdtzriyrkwbhkbqbbpozbik.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440. <\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u0443\u0442\u0438\u043b\u0438\u0442\u0435 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c DocumentBuilder, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u044e\u043c\u0435 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0438\u043b\u0434\u0435\u0440 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043a\u043e\u0434 \u043d\u0430 js, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043e\u0442\u0434\u0430\u0435\u0442\u0435 \u0435\u0433\u043e \u0443\u0442\u0438\u043b\u0438\u0442\u0435, \u0430 \u043e\u043d\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442. \u0418\u043b\u0438 \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-294309","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294309","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=294309"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294309\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}