{"id":1082,"date":"2020-03-02T15:48:08","date_gmt":"2020-03-02T15:48:08","guid":{"rendered":"https:\/\/lvboard.infostore.in.ua\/?p=1082"},"modified":"2020-03-02T15:48:10","modified_gmt":"2020-03-02T15:48:10","slug":"im-%d0%bd%d0%b0-%d0%be%d1%81%d0%bd%d0%be%d0%b2%d0%b5-nodejs-express-%d0%b8-angular-7-%d1%87%d0%b0%d1%81%d1%82%d1%8c-3","status":"publish","type":"post","link":"https:\/\/lvboard.infostore.in.ua\/?p=1082","title":{"rendered":"IM \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 NodeJS Express \u0438 Angular 7. \u0427\u0430\u0441\u0442\u044c 3"},"content":{"rendered":"\n<h2 id=\"heading\">\u0427\u0430\u0441\u0442\u044c 1. \u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f<\/h2>\n\n\n\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u043e\u0439:<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image4.png\"><img src=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image4.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>\u0413\u0434\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c 4 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0434\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438, \u0442\u043e\u0432\u0430\u0440\u0430\u043c\u0438 \u0438 \n\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0412\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438.<\/p>\n\n\n\n<p>\u041d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c RESTfull API \u0441\u0435\u0440\u0432\u0438\u0441 (\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f NodeJS \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Angular (\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c).<\/p>\n\n\n\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0421\u0423\u0411\u0414 PoptgresSQL.<\/p>\n\n\n\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n\n\n\n<p>RESTfull API c\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 NodeJS \u0438 Express<\/p>\n\n\n\n<h2 id=\"heading1\">\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/h2>\n\n\n\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n\n\n\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 NodeJS \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 OC &nbsp;\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Debian \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install nodejssudo npm cache clean -fsudo npm install -g nsudo n stable<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node -v<\/code><\/pre>\n\n\n\n<p>\u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u043c\u0435\u043d\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f 10.15.3.<\/p>\n\n\n\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u0431\u0443\u0434\u0443\u0449\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432 \u043d\u0435\u043c \u043f\u0430\u043a\u0435\u0442 npm (package.json).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir servercd servernpm init<\/code><\/pre>\n\n\n\n<p>\u0414\u0430\u043b\u0435\u0435, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c nodemon \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0435\u0440 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \n\u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u0440\u0430\u0432\u043a\u0430\u0445 \u0432 \u043a\u043e\u0434\u0435, \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e\u0439.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install --save nodemon<\/code><\/pre>\n\n\n\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Typescript, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0433\u043e.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install --save-dev typescript<\/code><\/pre>\n\n\n\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install express --savenpm install --save-dev @types\/node ts-node<\/code><\/pre>\n\n\n\n<p><strong>express<\/strong>&nbsp;\u2013 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f REST API<\/p>\n\n\n\n<p><strong>@types\/node<\/strong> \u2013&nbsp;\u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f nodejs<\/p>\n\n\n\n<p><strong>ts-node<\/strong> \u2013&nbsp;\u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c typescript \u0444\u0430\u0439\u043b\u044b \u0431\u0435\u0437 \u0442\u0440\u0430\u043d\u0441\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u0445 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 javascript<\/p>\n\n\n\n<p>\u0422\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0442\u0438\u043f\u044b \u0438 \u0434\u043b\u044f express.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install @types\/express --save<\/code><\/pre>\n\n\n\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b tsconfig.json c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0442\u0440\u0430\u043d\u0441\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 typescript.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\u00a0 \u00a0 \"compilerOptions\": {\u00a0 \u00a0 \"target\": \"es6\",\u00a0 \u00a0 \"module\": \"commonjs\",\u00a0 \u00a0 \"outDir\": \"dist\",\u00a0 \u00a0 \"sourceMap\": true\u00a0 \u00a0 },\u00a0 \u00a0 \"include\": [\u00a0 \u00a0 \"src\/**\/*.ts\"\u00a0 \u00a0 ],\u00a0 \u00a0 \"exclude\": [\u00a0 \u00a0 \"node_modules\",\u00a0 \u00a0 \".vscode\"\u00a0 \u00a0 ]}<\/code><\/pre>\n\n\n\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u0430\u043f\u043a\u0443 src \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u0444\u0430\u0439\u043b main.ts \u0441 \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import * as express from \"express\";const app = express();app.get(\"\/\", (req, res) => {\u00a0 \u00a0 res.send(\"Hello World\")})const PORT = process.env.PORT || 3000;app.listen(PORT, () => {\u00a0 \u00a0 \u00a0console.log(`Server is running in http:\/\/localhost:${PORT}`)})<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 script \u0444\u0430\u0439\u043b\u0430 package.json.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"scripts\": {\u00a0 \"start\": \"node --inspect=5858 -r ts-node\/register .\/src\/main.ts\",\u00a0 \"start:watch\": \"nodemon\",\u00a0 \"build\": \"tsc\"},<\/code><\/pre>\n\n\n\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 start, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n\n\n\n<p><strong>\u2014 inspect=5858<\/strong> \u2013&nbsp;\u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 5858 \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0438\u043d\u0433\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430;<\/p>\n\n\n\n<p><strong>-r ts-node\/register .\/src\/server.ts<\/strong>&nbsp;\u2013 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 typescript \u0444\u0430\u0439\u043b \u0433\u0434\u0435&nbsp;ts-node\/register&nbsp;\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043b\u0435\u0442\u0443.<\/p>\n\n\n\n<p><strong>\u201cstart\u201d: \u201cnodemon\u201d<\/strong>&nbsp;\u2013 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 nodemon, \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430.<\/p>\n\n\n\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f nodemon \u0432 \u0441\u0435\u043a\u0446\u0438\u044e nodemonConfig \u0444\u0430\u0439\u043b\u0430 package.json.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"nodemonConfig\": {\u00a0 \"ignore\": [\u00a0 \"**\/*.test.ts\",\u00a0 \"**\/*.spec.ts\",\u00a0 \".git\",\u00a0 \"node_modules\"\u00a0 ],\u00a0 \"watch\": [\u00a0 \"src\"\u00a0 ],\u00a0 \"exec\": \"npm start\",\u00a0 \"ext\": \"ts\"\u00a0 }<\/code><\/pre>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm start:watch<\/code><\/pre>\n\n\n\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0434\u0435\u0431\u0430\u0433\u0430 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 VS Code \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \n\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b launch.json \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 .vscode \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c \u0433\u0434\u0435 \n\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 nodejs \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\u00a0 \"version\": \"0.2.0\",\u00a0 \"configurations\": [\u00a0 \u00a0 {\u00a0 \u00a0 \u00a0 \"type\": \"node\",\u00a0 \u00a0 \u00a0 \"request\": \"attach\",\u00a0 \u00a0 \u00a0 \"name\": \"Node: Nodemon\",\u00a0 \u00a0 \u00a0 \"processId\": \"${command:PickProcess}\",\u00a0 \u00a0 \u00a0 \"restart\": true,\u00a0 \u00a0 \u00a0 \"protocol\": \"inspector\"\u00a0 \u00a0 }\u00a0 ]}<\/code><\/pre>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0437\u043d\u0430\u0447\u043a\u0430 \u0434\u0435\u0431\u0430\u0433\u0430 \u0432 \u043b\u0435\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443 \u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \n\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \n\u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u0438 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0431\u0440\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430 \u0432 \u043a\u043e\u0434\u0435 \u0432\u0430\u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0431\u0440\u043e\u0441\u0438\u0442 \u0432 \n\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image7.png\"><img src=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image7.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u044f\u043c\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 chrome. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \n\u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 chrome:\/\/inspect \u0438 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \n\u0438\u0441\u043a\u043e\u043c\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u0443\u0434\u0430 localhost:5858.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image3.png\"><img src=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image3.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 Remote target \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043a\u0443, \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0443 Inspect.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image6.png\"><img src=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image6.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL.<\/p>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \n\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 REST API \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435, \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043c\u0441\u044f \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \n\u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u0448\u0442\u043e\u0440.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image1.png\"><img src=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image1.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 node-postgres, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install --save pg<\/code><\/pre>\n\n\n\n<p>\u0414\u0430\u043b\u0435\u0435, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0443 Pool. \u0415\u0441\u043b\u0438 \n\u0438\u0445 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c, \u043e\u043d \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u0445 \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \n\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 PGHOST, PGDATABASE &nbsp;\u0438 \u0442.\u0434. \u0447\u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u0431\u044b \n\u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0435 \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0441\u0435\u043a\u0440\u0435\u0442\u044b \u0432 \n\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const Pool = require('pg').Poolconst pool = new Pool({\u00a0 user: 'postgres',\u00a0 host: 'localhost',\u00a0 database: 'curtains',\u00a0 password: '****',\u00a0 port: 5432,})<\/code><\/pre>\n\n\n\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0442\u0438\u043f\u044b express \u0438 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 pool \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0435.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import {Request, Response} from \"express\";...app.get(\"\/\", (req: Request, res: Response) => {\u00a0 \u00a0 pool.query('SELECT * FROM shop_category ORDER BY id ASC', (error, results) => {\u00a0 \u00a0 \u00a0 \u00a0 if (error) {\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 throw error\u00a0 \u00a0 \u00a0 \u00a0 }\u00a0 \u00a0 \u00a0 \u00a0 res.status(200).json(results.rows)\u00a0 \u00a0 \u00a0 })})<\/code><\/pre>\n\n\n\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image5.png\"><img src=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image5.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>\u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0447\u0435 (\u0431\u0435\u0437 \u043a\u043e\u043b\u0431\u0435\u043a\u043e\u0432), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f await\/async.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app.get(\"\/\", async (req: Request, res: Response) => {\u00a0 \u00a0 const result = await pool.query('SELECT * FROM shop_category ORDER BY id ASC')\u00a0 \u00a0 res.status(200).json(result.rows)})<\/code><\/pre>\n\n\n\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u0434\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0432 \u0432\u044b\u0432\u043e\u0434, \u0441\u0434\u0435\u043b\u0430\u0432 \u0432 \u0446\u0438\u043a\u043b\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0435\u0435 \u043f\u043e\u0434\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app.get(\"\/\", async (req: Request, res: Response) => {\u00a0 \u00a0 const result = await pool.query('SELECT * FROM shop_category ORDER BY id ASC')\u00a0 \u00a0 for(let category of result.rows){\u00a0 \u00a0 \u00a0 \u00a0 const subcats = await pool.query(`SELECT * FROM shop_subcategory where category_id=${category.id}`)\u00a0 \u00a0 \u00a0 \u00a0 category.subcategories = subcats.rows;\u00a0 \u00a0 }\u00a0 \u00a0 res.status(200).json(result.rows)})<\/code><\/pre>\n\n\n\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 main.ts \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c\n \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e, \u0432\u044b\u043d\u0435\u0441\u0435\u043c API, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \n\u0444\u0430\u0439\u043b api\/category.ts.<\/p>\n\n\n\n<p>\u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 RESTfull API \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import {Request, Response} from \"express\";export class CategoryAPI {\u00a0 \u00a0 put(req: Request, res: Response){}\u00a0 \u00a0 getAll(req: Request, res: Response){}\u00a0 \u00a0 getOne(req: Request, res: Response){}\u00a0 \u00a0 post(req: Request, res: Response){}\u00a0 \u00a0 delete(req: Request, res: Response){}}<\/code><\/pre>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0437\u043a\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0432 main.ts, \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b\n \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043b\u0430\u0441\u0441 CategoryAPI \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \n\u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import { CategoryAPI } from '.\/api\/category';const category_api = new CategoryAPI();app.get(\"\/category\/all\", category_api.getAll);app.get(\"\/category\/one\/:id\", category_api.getOne);app.delete(\"\/category\/delete\/:id\", category_api.delete);app.post(\"\/category\/edit\", category_api.post);app.put(\"\/category\/create\", category_api.put);<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 (\u0444\u0430\u0439\u043b api\/category.ts)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export class CategoryAPI {\u00a0 \u00a0 put(req: Request, res: Response){}\u00a0 \u00a0 async getAll(req: Request, res: Response){\u00a0 \u00a0 \u00a0 \u00a0 const result = await pool.query('SELECT * FROM shop_category ORDER BY id ASC')\u00a0 \u00a0 \u00a0 \u00a0 for(let category of result.rows){\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 console.log(category);\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 const subcats = await pool.query(`SELECT * FROM shop_subcategory where category_id=${category.id}`)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 category.subcategories = subcats.rows;\u00a0 \u00a0 \u00a0 \u00a0 }\u00a0 \u00a0 \u00a0 \u00a0 res.status(200).json(result.rows) \u00a0 \u00a0 \u00a0 \u00a0\u00a0 \u00a0 }\u00a0 \u00a0 getOne(req: Request, res: Response){}\u00a0 \u00a0 post(req: Request, res: Response){}\u00a0 \u00a0 delete(req: Request, res: Response){}}<\/code><\/pre>\n\n\n\n<h2 id=\"heading2\">\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/h2>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u043e\u0439\n \u0447\u0430\u0441\u0442\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u0434 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\n \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0440\u044f\u0434\u0430 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 url-\u044b \n\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 (GET POST \u0438 \u0442.\u0434.) \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438\u0445 \n\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u042d\u0442\u0438 \u0442\u0435\u0441\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0438 \u0432\u044b\u0434\u0430\u044e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0443\u0434\u0430 \u0436\u0435.\n \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n\n\n\n<p><strong>Jasmine<\/strong>&nbsp;\u2013 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438 \u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0445 \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0447\u0435\u0442.<\/p>\n\n\n\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e \u0438\u043b\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install jasmine-core jasmine @types\/jasmine jasmine-ts --save-dev<\/code><\/pre>\n\n\n\n<p><strong>Request<\/strong>&nbsp;\u2013 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install --save-dev request @types\/request<\/code><\/pre>\n\n\n\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u043f\u043a\u0443 spec c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 jasmine \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm test init<\/code><\/pre>\n\n\n\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432-\u0442\u0435\u0441\u0442\u043e\u0432 c js \u043d\u0430 ts \u0432 spec\/support\/jasmine.json<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\u00a0 \"spec_dir\": \"spec\",\u00a0 \"spec_files\": [\u00a0 \u00a0 \"**\/*[sS]pec.ts\"\u00a0 ],\u00a0 \"helpers\": [\u00a0 \u00a0 \"helpers\/**\/*.ts\"\u00a0 ],\u00a0 \"stopSpecOnExpectationFailure\": false,\u00a0 \"random\": true}<\/code><\/pre>\n\n\n\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 tsconfig.json<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"allowSyntheticDefaultImports\": true<\/code><\/pre>\n\n\n\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 jasmine \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import jasmine from 'jasmine';<\/code><\/pre>\n\n\n\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 test \u0432 \u0441\u0435\u043a\u0446\u0438\u044e scripts \u0444\u0430\u0439\u043b\u0430 package.json<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"scripts\": {\u00a0 ...\u00a0 \"test\": \".\/node_modules\/.bin\/jasmine-ts\"},<\/code><\/pre>\n\n\n\n<p>\u041f\u0438\u0448\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432 \u0444\u0430\u0439\u043b\u0435 spec\/category.spec.ts \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 2 url-\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import jasmine from 'jasmine';<br>import * as request from \"request\";<br><br>var base_url = \"http:\/\/localhost:3000\/\"<br><br>describe(\"Category API test\", function() {<br><br>&nbsp; &nbsp; it(\"All categories code 200\", function(done) {<br>&nbsp; &nbsp; &nbsp; &nbsp; request.get(base_url+'category\/all', function(error, response, body) {<br>&nbsp; &nbsp; &nbsp; &nbsp; expect(response.statusCode).toBe(200);<br>&nbsp; &nbsp; &nbsp; &nbsp; done();<br>&nbsp; &nbsp; &nbsp; });<br>&nbsp; &nbsp; });<br><br>&nbsp; &nbsp; it(\"Add category code 200\", function(done) {<br>&nbsp; &nbsp; &nbsp; request.post(base_url+'category\/create',{}, function(error, response, body) {<br>&nbsp; &nbsp; &nbsp; expect(response.statusCode).toBe(200);<br>&nbsp; &nbsp; &nbsp; done();<br>&nbsp; &nbsp; });<br>&nbsp; }); &nbsp; &nbsp;<br><br>});<\/pre>\n\n\n\n<p>\u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 npm run test \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0438\u0434\u0435\u0442\u044c:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2 specs, 0 failures<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Finished in 0.075 seconds<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u0438 \u043d\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image2.png\"><img src=\"https:\/\/wezom.com.ua\/Media\/files\/filemanager\/2019\/imnap1\/image2.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 post \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>it(\"Add category OK\", function(done) {\u00a0 \u00a0 let cat: any = {'name': 'Test category', 'name_slug': 'test-category' }\u00a0 \u00a0 request.post({ \u00a0 \u00a0 url: base_url+'category\/create', \u00a0 \u00a0 body: cat,\u00a0 \u00a0 \u00a0son: true\u00a0 \u00a0 }, function(error, response, body) {\u00a0 \u00a0 expect(JSON.parse(body)).toEqual({status: 0, message: 'Ok'});\u00a0 \u00a0 done();\u00a0 });});<\/code><\/pre>\n\n\n\n<p>\u0421\u0430\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0430\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0442\u0435\u0441\u0442\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f json \u043e\u0431\u044a\u0435\u043a\u0442 {status: 0, message: &#8216;Ok&#8217;}.<\/p>\n\n\n\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \n\u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 body-parser \u0432 \n\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 express.<\/p>\n\n\n\n<h2 id=\"heading3\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430.<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install body-parser @types\/body-parser --save<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u0438\u043c\u0438\u043d\u0435\u043d\u0438\u0435.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const app = express();import * as bodyParser from 'body-parser';app.use(bodyParser.json());<\/code><\/pre>\n\n\n\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>async post(req: Request, res: Response){\u00a0 \u00a0 const sql = 'INSERT INTO shop_subcategory(name, name_slug) VALUES($1, $2) RETURNING *'\u00a0 \u00a0 const values = [req.body.name, req.body.name_slug]\u00a0 \u00a0 try {\u00a0 \u00a0 \u00a0 \u00a0 const result = await pool.query(sql, values)\u00a0 \u00a0 \u00a0 \u00a0 res.status(200).json({status: 0, message: 'Ok'})\u00a0 \u00a0 \u00a0 } catch (err) {\u00a0 \u00a0 \u00a0 \u00a0 console.log(err.stack) \u00a0 \u00a0 \u00a0  res.status(200).json({status: 1, message: 'Error!'}) \u00a0 \u00a0  }}<\/code><\/pre>\n\n\n\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0442\u0438\u043b\u044c async\/away, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 try\/catch.<\/p>\n\n\n\n<p>\u041e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e json \u043e\u0442\u0432\u0435\u0442\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0435\n \u0442\u043e\u0432\u0430\u0440. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u043e\u0432\u0430\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e \n\u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f. \u041a \u043d\u0435\u043c\u0443 \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \n\u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0438, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0438 \u043f\u0440. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f json \n(\u0441\u0435\u0440\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u044f) \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u043e\u0432\u0430\u0440\u0435 \u0443\u0434\u043e\u0431\u043d\u0435\u0439 \u0432\u0441\u0435\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u043e\u0434\u043d\u043e\u043c\n \u043c\u0435\u0441\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0442\u043e\u0432\u0430\u0440\u0430. \u0415\u0441\u043b\u0438 \u043c\u044b \n\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u0442\u043e\u0432\u0430\u0440\u0430, \u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442, \u0442.\u043a. \u0432\n \u043d\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 await\/async \u0438 \n\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u043c\u0438\u0441. \u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0432\u0438\u0434\u0435\u0442\u0441\u044f \n\u0430\u0432\u0442\u043e\u0440\u0443 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0431\u0440\u0438\u0447\u043d\u043e\u0433\u043e async \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u043e\u0432\u0430\u0440\u0430, \n\u043a\u043e\u0442\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044f\n \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u0432\u0430\u0440\u0435.<\/p>\n\n\n\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Good{\u00a0 id: number;\u00a0 name: string;\u00a0 name_slug: string;\u00a0 desc: string;\u00a0 subcategory_id: number;\u00a0 subcategory: any;\u00a0 image: any;\u00a0 constructor(){}\u00a0 public static async serialize(json_obj: any){\u00a0 \u00a0 let obj = new Good();\u00a0 \u00a0 obj.id = json_obj.id;\u00a0 \u00a0 obj.name = json_obj.name;\u00a0 \u00a0 obj.name_slug = json_obj.name_slug;\u00a0 \u00a0 obj.desc = json_obj.desc;\u00a0 \u00a0 obj.subcategory_id = json_obj.subcategory_id;\u00a0 \u00a0 \/\/\/ \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u043e\u0434\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e\u00a0 \u00a0 let sql_sub = 'SELECT * FROM shop_subcategory where id=$1';\u00a0 \u00a0 let result_sub = await pool.query(sql_sub,[obj.subcategory_id]);\u00a0 \u00a0 obj.subcategory = {'name': result_sub.rows[0].name, 'name_slug': result_sub.rows[0].name_slug};\u00a0 \u00a0 \/\/\/ \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u00a0 \u00a0 let sql_image = 'SELECT * FROM shop_image where good_id=$1';\u00a0 \u00a0 let result_image = await pool.query(sql_image,[obj.id]);\u00a0 \u00a0 obj.image = {'image': result_image.rows[0].image}; \u00a0 \u00a0\u00a0 \u00a0 return obj;\u00a0 }\u00a0}<\/code><\/pre>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \n\u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u043e\u0432\u0430\u0440\u0435, \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\n \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438 \u0432\u0435\u0440\u043d\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u0432 \u0432\u0438\u0434\u0435 \njson-\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export class GoodAPI {\u00a0 \u00a0 async getOne(req: Request, res: Response){\u00a0 \u00a0 \u00a0 \u00a0const sql = 'SELECT * FROM shop_good where id=$1';\u00a0 \u00a0 \u00a0 \u00a0const result = await pool.query(sql,[req.params.id]);\u00a0 \u00a0 \u00a0 \u00a0let good = await Good.serialize(result.rows[0]);\u00a0 \u00a0 \u00a0 \u00a0res.json(good);\u00a0 \u00a0 }}<\/code><\/pre>\n\n\n\n<h2 id=\"heading4\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \n\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0431\u0430\u0437\u0435 NodeJS, \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0442\u0438\u043f\u043e\u0432\u0430\u044f \n\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0430\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c RESTfull API \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b.\n \u041e\u0441\u0432\u0435\u0449\u0435\u043d\u044b \u043f\u0440\u0438\u0435\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \n\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f SQL \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 node-postgres. \u0422\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u0430 \n\u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u0430 \u0442\u0435\u043c\u0430 unit \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Jasmine.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u0427\u0430\u0441\u0442\u044c 1. \u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u043e\u0439:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[30],"tags":[87],"_links":{"self":[{"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/posts\/1082"}],"collection":[{"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1082"}],"version-history":[{"count":1,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/posts\/1082\/revisions"}],"predecessor-version":[{"id":1083,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/posts\/1082\/revisions\/1083"}],"wp:attachment":[{"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}