{"id":309973,"date":"2020-09-15T15:01:20","date_gmt":"2020-09-15T15:01:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=309973"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=309973","title":{"rendered":"NodeJS: 12 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/519036\/\"><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/519036\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/20\/yy\/o4\/20yyo4l1pdliogvvjijidwjpz-4.jpeg\"><\/div>\n<p><\/a><\/p>\n<p>  \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d\u0430 \u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0430\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u043e\u0439 \u0438 \u0445\u0443\u043a\u0430\u043c\u0438 Git, \u0437\u0430\u0449\u0438\u0442\u0430 express-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438, \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c 180 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u0432\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f. \u041f\u043e\u0434\u0431\u043e\u0440\u043a\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c NodeJS, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u0441\u043a\u0435\u043f\u0442\u0438\u043a\u043e\u0432.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043a\u043e\u0434\u043e\u043c, \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u0412\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445, \u044f \u0434\u0443\u043c\u0430\u044e, \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u0438 npm-\u043f\u0430\u043a\u0435\u0442\u044b \u043a\u0430\u043a \u0442\u043e, \u0447\u0442\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<h2><font color=\"#09b744\">1. Husky<\/font><\/h2>\n<p>  Husky \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0445\u0443\u043a\u043e\u0432 \u0432 Git. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u0438\u043d\u0442\u043e\u0432\u0430\u043b\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c \u0438\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jo\/su\/ec\/josuecbarzozbksbqdji291_888.png\"><br \/>  <a href=\"https:\/\/github.com\/typicode\/husky\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 husky<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add husky<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0445\u0443\u043a\u043e\u0432 \u0441 <code>husky<\/code>:<\/p>\n<pre><code class=\"json\">\/\/ package.json {   &quot;husky&quot;: {     &quot;hooks&quot;: {       &quot;pre-commit&quot;: &quot;npm lint&quot;,       &quot;pre-push&quot;: &quot;npm test&quot;     }   } } <\/code><\/pre>\n<p>  <code>pre-commit<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c.<br \/>  <code>pre-push<\/code> \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">2. Dotenv<\/font><\/h2>\n<p>  Dotenv \u2014 \u043c\u043e\u0434\u0443\u043b\u044c \u0431\u0435\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041e\u043d \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 <code>.env<\/code> \u0432 <a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/process.html#process_process_env\">process.env<\/a>. \u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u0440\u0435\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043a\u043e\u0434\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043e \u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0438 <a href=\"http:\/\/12factor.net\/config\">\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u0432<\/a>. <a href=\"https:\/\/github.com\/motdotla\/dotenv\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 dotenv<\/a>.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add dotenv<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u043f\u0438\u0448\u0438\u0442\u0435 <code>require<\/code> \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>dotenv<\/code>:<\/p>\n<pre><code class=\"json\">require('dotenv').config() <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 <code>.env<\/code> \u0444\u0430\u0439\u043b \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b \u0432 \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 <code>NAME=VALUE<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"plaintext\">DB_HOST=localhost DB_USER=root DB_PASS=s1mpl3 <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c <code>process.env<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043b\u044e\u0447\u0438 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 <code>.env<\/code>:<\/p>\n<pre><code class=\"javascript\">const db = require('db') db.connect({ host: process.env.DB_HOST, username: process.env.DB_USER, password: process.env.DB_PASS}) <\/code><\/pre>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">3. date-fns<\/font><\/h2>\n<p>  <a href=\"https:\/\/date-fns.org\/\">Date-fns<\/a> \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 lodash, \u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438. \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439, \u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 JavaScript \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 Node.JS.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ue\/3c\/fx\/ue3cfxmzmn0apmifadls0y0oj3o.png\"><br \/>  <a href=\"https:\/\/github.com\/date-fns\/date-fns\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 date-fns<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add date-fns<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0441 date-fns:<\/p>\n<pre><code class=\"javascript\">import { compareAsc, format } from 'date-fns' format(new Date(2014, 1, 11), 'yyyy-MM-dd')   \/\/=&gt; '2014-02-11' const dates = [     new Date(1995, 6, 2),     new Date(1987, 1, 11),     new Date(1989, 6, 10),   ]   dates.sort(compareAsc)   \/\/=&gt; [   \/\/   Wed Feb 11 1987 00:00:00,   \/\/   Mon Jul 10 1989 00:00:00,   \/\/   Sun Jul 02 1995 00:00:00   \/\/ ] <\/code><\/pre>\n<p>  <a href=\"https:\/\/date-fns.org\/docs\/\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">4. Bunyan<\/font><\/h2>\n<p>  Bunyan \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f JSON \u0434\u043b\u044f Node.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b0\/jb\/bo\/b0jbbofpeixlftfq42vyn2wmexi.png\"><br \/>  <a href=\"https:\/\/github.com\/trentm\/node-bunyan\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 bunyan<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add bunyan<\/code><\/pre>\n<p>  <strong>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/strong> CLI <code>bunyan<\/code> \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c (\u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0433\u043e) \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u043b\u043e\u0433\u043e\u0432 Bunyan. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e: <code>yarn add global bunyan<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432 <code>PATH<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Bunyan \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  Bunyan \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u0430 JSON \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 Node.js.<\/p>\n<pre><code class=\"javascript\">\/\/ hi.jsconst bunyan = require('bunyan'); const log = bunyan.createLogger({name: &quot;myapp&quot;}); log.info(&quot;hi&quot;); <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 <code>node hi.js<\/code>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uq\/qi\/8n\/uqqi8nh3sc5i-sd_6xwyf2aaqwm.png\"><\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">5. Ramda<\/font><\/h2>\n<p>  Ramda \u2014 \u044d\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u0430\u044f \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435. \u041e\u043d\u0430 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u0435\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c. \u041d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0435 \u043e\u0442 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u0430 Ramda. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/e9\/zk\/an\/e9zkanh1fvo8wssxqlecwamumfk.png\"><br \/>  <a href=\"https:\/\/github.com\/ramda\/ramda\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 ramda<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add ramda<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<pre><code class=\"javascript\">import * as R from 'ramda' const greet = R.replace('{name}', R.__, 'Hello, {name}!');  greet('Alice'); \/\/=&gt; 'Hello, Alice!'<\/code><\/pre>\n<p>  <a href=\"https:\/\/ramdajs.com\/repl\/?v=0.27.0#?const%20greet%20%3D%20R.replace%28%27%7Bname%7D%27%2C%20R.__%2C%20%27Hello%2C%20%7Bname%7D%21%27%29%3B%0Agreet%28%27Alice%27%29%3B%20%2F%2F%3D%3E%20%27Hello%2C%20Alice%21%27\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430<\/a><\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">6. Debug<\/font><\/h2>\n<p>  Debug \u2014 \u044d\u0442\u043e \u043a\u0440\u043e\u0448\u0435\u0447\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 JavaScript, \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043e \u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 Node.JS.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uo\/2o\/r8\/uo2or8utfnnoyzxfoba8nceve38.png\"><br \/>  <a href=\"https:\/\/github.com\/visionmedia\/debug\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 Debug<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add debug<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  Debug \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043c\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u0438 \u043e\u043d\u0430 \u0432\u0435\u0440\u043d\u0451\u0442 \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <code>console.error<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<pre><code class=\"javascript\">const debug = require('debug'); const log = debug('http:server'); const http = require('http'); const name = 'My App name'; log('booting %o', name); http.createServer((req, res) =&gt; {   log(req.method + ' ' + req.url);   res.end('debug examplen'); }).listen(3200, () =&gt; {   log('listening'); }); \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \/\/ DEBUG=http:server node app.js <\/code><\/pre>\n<p>  \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u0446\u0435\u043b\u043e\u043c \u0438\u043b\u0438 \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u0435\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/on\/_m\/zk\/on_mzk35ddq0evudv5nwnwdhlqg.png\">  <\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">7. Flat<\/font><\/h2>\n<p>  Flat \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u043b\u043e\u0441\u043a\u0438\u043c. \u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447\u0430\u043c\u0438. [\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432. \u2014 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0435\u043b\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u043a\u0430].<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/h7\/fv\/kh\/h7fvkh0usmpmsaadapitpgapnww.png\"><br \/>  <a href=\"https:\/\/github.com\/hughsk\/flat\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 Flat<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add flat<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<pre><code class=\"javascript\">const flatten = require('flat') flatten({       key1: {           keyA: 'valueI'       },       key2: {           keyB: 'valueII'       },       key3: { a: { b: { c: 2 } } }   }) \/\/ {   \/\/   'key1.keyA': 'valueI',   \/\/   'key2.keyB': 'valueII',   \/\/   'key3.a.b.c': 2   \/\/ } <\/code><\/pre>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">8. JSON5<\/font><\/h2>\n<p>  \u0424\u043e\u0440\u043c\u0430\u0442 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 <a href=\"https:\/\/json5.org\/\">JSON5<\/a> \u2014 \u044d\u0442\u043e \u043d\u0430\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <a href=\"https:\/\/tools.ietf.org\/html\/rfc7159\">JSON<\/a>, \u0446\u0435\u043b\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043c\u044f\u0433\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 JSON \u043f\u0443\u0442\u0451\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 <a href=\"https:\/\/www.ecma-international.org\/ecma-262\/5.1\/\">ECMAScript 5.1<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ti\/mg\/4z\/timg4z3-gnts6jizj5lrxbj5yii.png\"><br \/>  <a href=\"https:\/\/github.com\/json5\/json5\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 JSON5<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add json5   const JSON5 = require('json5') <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430. JSON5 \u2014 \u044d\u0442\u043e \u043d\u0430\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 JSON.<\/p>\n<pre><code class=\"json\">{   \/\/ \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438   unquoted: 'and you can quote me on that',   singleQuotes: 'I can use &quot;double quotes&quot; here',   lineBreaks: &quot;Look, Mom! \\ No \\\\n's!&quot;,   hexadecimal: 0xdecaf,   leadingDecimalPoint: .8675309, andTrailing: 8675309.,   positiveSign: +1,   trailingComma: 'in objects', andIn: ['arrays',],   &quot;backwardsCompatible&quot;: &quot;with JSON&quot;, } <\/code><\/pre>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">9. ESLint<\/font><\/h2>\n<p>  <a href=\"https:\/\/eslint.org\/\">ESLint<\/a> \u2014 \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. ESLint \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u0434\u0435 ECMAScript\/JavaScript.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qu\/jh\/rg\/qujhrgn_eb-bbcfpvbxxpad2w2k.png\"><br \/>  <a href=\"https:\/\/github.com\/eslint\/eslint\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 ESLint<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add eslint<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"plaintext\">.\/node_modules\/.bin\/eslint --init <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c ESLint \u0432 \u043b\u044e\u0431\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0438\u043b\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"bash\">.\/node_modules\/.bin\/eslint yourfile.js <\/code><\/pre>\n<p>  <a href=\"https:\/\/eslint.org\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u0441\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043f\u043e \u043d\u0430\u0447\u0430\u043b\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435.<\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">10. PM2<\/font><\/h2>\n<p>  PM2 \u2014 \u044d\u0442\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d\u0430 \u0441\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c\u0438, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0445 \u0431\u0435\u0437 \u043f\u0440\u043e\u0441\u0442\u043e\u0435\u0432 \u0438 \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gj\/jn\/yb\/gjjnybme6gnedqwbcxmozfaclps.png\"><br \/>  <a href=\"https:\/\/github.com\/Unitech\/pm2\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 pm2<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add global pm2<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (Node.js, Python, Ruby, \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 <code>$PATH<\/code> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435) \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">pm2 start app.js<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0434\u0435\u043c\u043e\u043d\u0430, \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. <a href=\"https:\/\/pm2.keymetrics.io\/docs\/usage\/quick-start\/\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438, \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442<\/a>.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"bash\">pm2 ls<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ct\/e8\/ux\/cte8uxmkelimb0ijs8nqrasmd34.png\"><\/p>\n<p>  \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 <a href=\"https:\/\/pm2.io\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a>, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">11. Helmet<\/font><\/h2>\n<p>  Helmet \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f express \u0447\u0435\u0440\u0435\u0437 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438. \u042d\u0442\u043e \u043d\u0435 \u0441\u0435\u0440\u0435\u0431\u0440\u044f\u043d\u0430\u044f \u043f\u0443\u043b\u044f, \u043d\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9l\/zf\/gt\/9lzfgtzbk00afr9w1kqxf3sdaw0.png\"><br \/>  <a href=\"https:\/\/github.com\/helmetjs\/helmet\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 Helmet<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add helmet<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  <code>Helmet<\/code> \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u0441\u0442\u0438\u043b\u0435 <a href=\"https:\/\/github.com\/senchalabs\/connect\">Connect<\/a> \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438, \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043d\u0430 <a href=\"https:\/\/expressjs.com\/\">Express<\/a>. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Koa, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/github.com\/venables\/koa-helmet\"><code>koa-helmet<\/code><\/a>.)<\/p>\n<pre><code class=\"javascript\">const express = require(&quot;express&quot;);   const helmet = require(&quot;helmet&quot;); const app = express(); app.use(helmet()); <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f helmet \u2014 \u044d\u0442\u043e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 11 \u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e<\/p>\n<pre><code class=\"javascript\">\/\/ \u042d\u0442\u043e... app.use(helmet()); \/\/ ...\u0418 \u044d\u0442\u043e:  app.use(helmet.contentSecurityPolicy());   app.use(helmet.dnsPrefetchControl());   app.use(helmet.expectCt());   app.use(helmet.frameguard());   app.use(helmet.hidePoweredBy());   app.use(helmet.hsts());   app.use(helmet.ieNoOpen());   app.use(helmet.noSniff());   app.use(helmet.permittedCrossDomainPolicies());   app.use(helmet.referrerPolicy());   app.use(helmet.xssFilter()); <\/code><\/pre>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h2><font color=\"#09b744\">12. Compression<\/font><\/h2>\n<p>  Compression \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uf\/rp\/fw\/ufrpfwksodmfgbguuhtmk0eazmk.png\"><br \/>  <a href=\"https:\/\/github.com\/expressjs\/compression\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 compression<\/a><\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn add compression<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <a href=\"https:\/\/github.com\/expressjs\/express\">express<\/a> \u0438\u043b\u0438 <code>connect<\/code> \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0438\u0442\u0435 <code>compression()<\/code> \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u043c \u041f\u041e. \u0417\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e, \u0431\u0443\u0434\u0443\u0442 \u0441\u0436\u0430\u0442\u044b.<\/p>\n<pre><code class=\"javascript\">const compression = require('compression')   const express = require('express') const app = express() \/\/ \u0441\u0436\u0438\u043c\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b   app.use(compression())\/\/ ... <\/code><\/pre>\n<p>  <b>\u0410 \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 NodeJS \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0432\u044b?<\/b><\/p>\n<blockquote>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rd\/kl\/lr\/rdkllrbtrth_kdpceb-vxzrxl1o.jpeg\" alt=\"image\"><\/div>\n<p>  \u0423\u0437\u043d\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044e \u0441 \u043d\u0443\u043b\u044f \u0438\u043b\u0438 Level Up \u043f\u043e \u043d\u0430\u0432\u044b\u043a\u0430\u043c \u0438 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0435, \u043f\u0440\u043e\u0439\u0434\u044f \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u044b SkillFactory:<\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/javascript?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=FJS&amp;utm_term=regular&amp;utm_content=150920\">\u041a\u0443\u0440\u0441 \u043f\u043e JavaScript<\/a> (12 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=WEBDEV&amp;utm_term=regular&amp;utm_content=150920\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a> (8 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/java?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=JAVA&amp;utm_term=regular&amp;utm_content=150920\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441 \u043d\u0443\u043b\u044f<\/a> (18 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">E\u0449\u0435 \u043a\u0443\u0440\u0441\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=PWS&amp;utm_term=regular&amp;utm_content=150920\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a> (9 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/data-scientist?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=DST&amp;utm_term=regular&amp;utm_content=150920\">\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u0438 Data Science \u0441 \u043d\u0443\u043b\u044f<\/a> (12 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/analytics?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=SDA&amp;utm_term=regular&amp;utm_content=150920\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 \u0441 \u043b\u044e\u0431\u044b\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c<\/a> (9 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/ml-programma-machine-learning-online?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=ML&amp;utm_term=regular&amp;utm_content=150920\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a> (12 \u043d\u0435\u0434\u0435\u043b\u044c)<\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/devops?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=DEVOPS&amp;utm_term=regular&amp;utm_content=150920\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a> (12 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<li><a href=\"https:\/\/contented.ru\/edu\/uxdesigner?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=UXS&amp;utm_term=regular&amp;utm_content=150920\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f UX-\u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440 \u0441 \u043d\u0443\u043b\u044f<\/a> (9 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<li><a href=\"https:\/\/contented.ru\/edu\/webdesigner?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=WBDS&amp;utm_term=regular&amp;utm_content=150920\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Web-\u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440<\/a> (7 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/li>\n<\/ul>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p><\/blockquote>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/519036\/\"> https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/519036\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/519036\/\"><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/519036\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/20\/yy\/o4\/20yyo4l1pdliogvvjijidwjpz-4.jpeg\"><\/div>\n<p><\/a><\/p>\n<p>  \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d\u0430 \u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0430\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u043e\u0439 \u0438 \u0445\u0443\u043a\u0430\u043c\u0438 Git, \u0437\u0430\u0449\u0438\u0442\u0430 express-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438, \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c 180 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u0432\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f. \u041f\u043e\u0434\u0431\u043e\u0440\u043a\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c NodeJS, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u0441\u043a\u0435\u043f\u0442\u0438\u043a\u043e\u0432.  <\/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-309973","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309973","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=309973"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309973\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=309973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=309973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}