{"id":1202,"date":"2020-06-20T13:56:27","date_gmt":"2020-06-20T13:56:27","guid":{"rendered":"https:\/\/lvboard.infostore.in.ua\/?p=1202"},"modified":"2020-06-20T13:56:27","modified_gmt":"2020-06-20T13:56:27","slug":"14-%d1%81%d0%b0%d0%bc%d1%8b%d1%85-%d0%bf%d0%be%d0%bf%d1%83%d0%bb%d1%8f%d1%80%d0%bd%d1%8b%d1%85-node-js-%d0%b1%d0%b8%d0%b1%d0%bb%d0%b8%d0%be%d1%82%d0%b5%d0%ba-%d0%b2-2020-%d0%b3%d0%be%d0%b4%d1%83","status":"publish","type":"post","link":"https:\/\/lvboard.infostore.in.ua\/?p=1202","title":{"rendered":"14 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 Node.js-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 2020 \u0433\u043e\u0434\u0443"},"content":{"rendered":"\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u0432\u0442\u043e\u0440 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u0430\u0445\u043e\u0434\u043a\u0430\u043c\u0438 \u0441\u0440\u0435\u0434\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 Nodejs.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h3><a href=\"https:\/\/expressjs.com\/ru\/\">Express<\/a><\/h3>\n\n\n\n<p>\u0411\u044b\u0441\u0442\u0440\u044b\u0439, \u0433\u0438\u0431\u043a\u0438\u0439, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439, \u043b\u0435\u0433\u043a\u0438\u0439 \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0435\u043a\u0430 MEAN (MongoDB, Express, Angular, Node) \u0438\u043b\u0438 MERN (React \u0432\u043c\u0435\u0441\u0442\u043e Angular)<\/li><li>\u043b\u0435\u0433\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a GET, PUT, POST \u0438 DELETE<\/li><li>\u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445, \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0438 \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/li><\/ul>\n\n\n\n<h5>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0439 \u0437\u0430 \u043d\u0435\u0434\u0435\u043b\u044e<\/h5>\n\n\n\n<p>11 \u043c\u043b\u043d<\/p>\n\n\n\n<h5>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b<\/h5>\n\n\n\n<p>Koa, Hapi, Meteor<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/cheerio\">Cheerio<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (\u00ab\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430\u00bb) \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, HTML, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u00ab\u0442\u0440\u0430\u0432\u0435\u0440\u0441\u0430\u00bb) \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst cheerio = require('cheerio')\n\tconst $ = cheerio.load('&lt;ul id=\"fruits\">...&lt;\/ul>')\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0435\u0431-\u0441\u043a\u0430\u043d\u0435\u0440\u043e\u0432 (\u00ab\u0441\u043a\u0440\u0435\u0431\u043a\u043e\u0432\u00bb)<\/li><li>\u043b\u0435\u0433\u043a\u0438\u0439, \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>4.2 \u043c\u043b\u043d<\/p>\n\n\n\n<h5>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b<\/h5>\n\n\n\n<p>jsdom, puppeteer<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/nodemailer\">Nodemailer<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst nodemailer = require('nodemailer')\n\n\tconst testAccount = await nodemailer.createTestAccount()\n\n\tconst transporter = nodemailer.createTransport({\n\t\thost: 'smtp.ethereal.email',\n\t\tport: 587,\n\t\tsecure: false,\n\t\tauth: {\n\t\t\tuser: testAccount.user,\n\t\t\tpass: testAccount.pass\n\t\t}\n\t})\n\n\tconst info = await transporter.sendMail({\n\t\tfrom: '\"John Smith\" &lt;smith@example.com>',\n\t\tto: 'foo@example.com, bar@example.com',\n\t\tsubject: 'hello',\n\t\ttext: 'hello crazy world',\n\t\thtml: '&lt;strong>hello crazy world&lt;\/strong>'\n\t})\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 SMTP<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>980 \u0442\u044b\u0441.<\/p>\n\n\n\n<h5>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b<\/h5>\n\n\n\n<p>sendmail, emailjs<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/socket.io\">Socket.io<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst server = require('http').createServer()\n\tconst io = require('socket.io')(server)\n\tio.on('connection', client => {\n\t\tclient.on('event', data => { ... })\n\t\tclient.on('disconnect', () => { ... })\n\t})\n\tserver.listen(3000)\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u00ab\u0436\u0438\u0432\u043e\u0439\u00bb \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438, \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>3 \u043c\u043b\u043d<\/p>\n\n\n\n<h5>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b<\/h5>\n\n\n\n<p>pusher, websockets<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/fake\">Faker<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0444\u0435\u0439\u043a\u043e\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 \u00ab\u043d\u043e\u0434\u0435\u00bb.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst faker = require('faker')\n\n\tconst randomName = faker.name.findName()\n\tconst randomEmail = faker.internet.email()\n\tconst randomCard = faker.helpers.createCard() \/\/ \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430 \u0441 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0432 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044d\u043a\u0435\u043d\u0434\u0430<\/li><li>\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0438\u043c\u0435\u043d\u0438, \u0444\u0430\u043c\u0438\u043b\u0438\u0438 \u0438 \u0442.\u0434.<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>1.4 \u043c\u043b\u043d<\/p>\n\n\n\n<h5>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b<\/h5>\n\n\n\n<p>casual<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/morgan\">Morgan<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tmorgan\n\t(':method:url :status :res&#91;content-length] - :response-time ms')\n\n\t---\n\n\tconst express = require('express')\n\n\tconst morgan = require('morgan')\n\n\tconst app = express()\n\n\tapp.use(morgan('combined'))\n\n\tapp.get('\/', (req, res) => res.send('hello crazy world'))\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0444\u0430\u0439\u043b, \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/li><li>\u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u00ab\u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00bb<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>2 \u043c\u043b\u043d<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/http-errors\">Http-errors<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u0446\u0435\u043b\u044f\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Express, Koa, Connect \u0438 \u0434\u0440.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tapp.use((req, res, next) => {\n\t\tif(!req.user) return next(createError('401', '\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430.'))\n\t\tnext()\n\t})\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u044d\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a<\/li><li>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Error<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\texpose\n\theaders\n\tmessage\n\tstatus\n\tstatusCode\n<\/code><\/pre>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>27 \u043c\u043b\u043d<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/body-parser\">Body-parser<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 (\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430) \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n\n\n\n<p>\u041f\u0430\u0440\u0441\u0438\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (req.body) \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst express = require('express')\n\tconst bodyParser = require('body-parser')\n\n\tconst app = express()\n\n\t\/\/ \u043f\u0430\u0440\u0441\u0438\u043c application\/x-www-form-urlencoded\n\tapp.use(bodyParser.urlencoded({ extended: false }))\n\n\t\/\/ \u043f\u0430\u0440\u0441\u0438\u043c application\/json\n\tapp.use(bodyParser.json())\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u0442\u0435\u043b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/li><li>\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (inflate, type, verify \u0438 \u043f\u0440\u043e\u0447.)<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>13 \u043c\u043b\u043d<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/sequelize\">Sequelize<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u0430\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Postgres, MySQL, MariaDB, SQLite \u0438 Microsoft SQL Server.<\/p>\n\n\n\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 (\u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0435) \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u044d\u043d\u0435\u0440\u0433\u0438\u0447\u043d\u0443\u044e \u0438 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442.\u0434.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst sequelize = new Sequelize(\n\t\t'database', 'username', 'password', {\n\t\t\thost: 'localhost',\n\t\t\tdialect: \/* \u043e\u0434\u0438\u043d \u0438\u0437 'mysql' | 'mariadb' | 'postgres' | 'mssql' *\/\n\t\t}\n\t)\n<\/code><\/pre>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>720 \u0442\u044b\u0441.<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/passport\">Passport<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0435 \u0441 Express \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n\n\n\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u2014 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tpassport.use(new LocalStrategy(\n\t\t(username, password, done) => {\n\t\t\tUser.findOne({ username: username }, (err, user) => {\n\t\t\t\tif(err) { return done(err) }\n\n\t\t\t\tif(!user) { return done(null, false) }\n\n\t\t\t\tif(!user.verifyPassword(password)) { return done(null, false) }\n\n\t\t\t\treturn done(null, user)\n\t\t\t})\n\t\t}\n\t))\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/li><li>\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 OAuth \u0438 OpenID (\u0432\u0445\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 Facebook, Twitter \u0438 \u0442.\u0434.)<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>810 \u0442\u044b\u0441.<\/p>\n\n\n\n<h3>Dotenv<\/h3>\n\n\n\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (\u0442\u043e\u0447\u043a\u0438) \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 .env \u0432 process.env.<\/p>\n\n\n\n<p>\u0425\u0440\u0430\u043d\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043a\u043e\u0434\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\trequire('dotenv').config()\n\n\tconst db = require('db')\n\n\tdb.connect({\n\t\thost: process.env.DB_HOST,\n\t\tusername: process.env.DB_USER,\n\t\tpassword: process.env.DB_PASS\n\t})\n\n\t\/\/ \u0444\u0430\u0439\u043b .env\n\tDB_HOST = localhost\n\tDB_USER = root\n\tDB_PASS=12345\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u044b, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a AWS, sql \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u0430\u0440\u043e\u043b\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438<\/li><li>\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043a\u043e\u0434\u0430<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>10 \u043c\u043b\u043d<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/multer\">Multer<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 multipart\/form-data \u2014 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst express = require('express')\n\n\tconst multer = require('multer')\n\n\tconst upload = multer({ desc: 'uploads\/' })\n\n\tconst app = express()\n\n\tapp.post('\/profile', upload.single('avatar'), (req, res, next) => {\n\t\t\/\/ req.file - \u044d\u0442\u043e \u0444\u0430\u0439\u043b 'avatar'\n\t\t\/\/ req.body \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438\n\t})\n\n\tapp.post('\/photos\/upload', upload.array('photos', 12), (req, res, next) => {\n\t\t\/\/ req.files - \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0444\u0430\u0439\u043b\u043e\u0432 'photos'\n\t\t\/\/ req.body \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u043f\u0440\u0438 \u0438\u0445 \u043d\u0430\u043b\u0438\u0447\u0438\u0438\n\t})\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 multipart\/form-data<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>92 \u0442\u044b\u0441.<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/axios\">Axios<\/a><\/h3>\n\n\n\n<p>\u041e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u0430\u0445 HTTP-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0438 node.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst axios = require('axios')\n\n\t\/\/ \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e ID\n\taxios.get('\/user?ID=12345')\n\t\t.then(response => {\n\t\t\t\/\/ \u043a\u043e\u0434\n\t\t\tconsole.log(response)\n\t\t}).catch(error => {\n\t\t\t\/\/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a\n\t\t\tconsole.log(error)\n\t\t}).finally(() => {\n\t\t\t\/\/ \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f\n\t\t})\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 Node<\/li><li>\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430<\/li><li>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>9.6 \u043c\u043b\u043d<\/p>\n\n\n\n<h3><a href=\"https:\/\/www.npmjs.com\/package\/cors\">CORS<\/a><\/h3>\n\n\n\n<p>\u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u0434\u043b\u044f Connect\/Express, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tconst express = require('express')\n\n\tconst cors = require('cors')\n\n\tconst app = express()\n\n\tapp.use(cors())\n\n\tapp.get('\/products\/:id', (req, res, next) => {\n\t\tres.json({ msg: '\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0437 \u043b\u044e\u0431\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432!' })\n\t})\n\n\tapp.listen(80, () => {\n\t\tconsole.log('ok')\n\t})\n<\/code><\/pre>\n\n\n\n<h5>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f<\/h5>\n\n\n\n<ul><li>\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 CORS<\/li><\/ul>\n\n\n\n<h5>\u0415\u0436\u0435\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h5>\n\n\n\n<p>3.7 \u043c\u043b\u043d<\/p>\n\n\n\n<p>\u0423\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u0430 \u043a\u0430\u043a\u0438\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c \u0432\u044b?<\/p>\n\n\n\n<p>\u041f\u0440\u0438\u043c. \u043f\u0435\u0440.: \u044f \u043d\u043e\u0432\u0438\u0447\u043e\u043a \u0432 Node.js, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u043e\u0448\u0443 \u0438\u0437\u0432\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u0432\u0442\u043e\u0440 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u0430\u0445\u043e\u0434\u043a\u0430\u043c\u0438 \u0441\u0440\u0435\u0434\u0438 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 Nodejs.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[30],"tags":[94],"_links":{"self":[{"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/posts\/1202"}],"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=1202"}],"version-history":[{"count":1,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/posts\/1202\/revisions"}],"predecessor-version":[{"id":1203,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=\/wp\/v2\/posts\/1202\/revisions\/1203"}],"wp:attachment":[{"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lvboard.infostore.in.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}