{"id":95695,"date":"2025-02-02T14:10:45","date_gmt":"2025-02-02T10:40:45","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/"},"modified":"2025-02-02T14:10:45","modified_gmt":"2025-02-02T10:40:45","slug":"how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/","title":{"rendered":"\u0646\u062d\u0648\u0647 \u0633\u0627\u062e\u062a API GraphQL \u0627\u0632 \u0627\u0628\u062a\u062f\u0627 \u062f\u0631 Node.js"},"content":{"rendered":"<div data-article-id=\"2255046\" id=\"article-body\">\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter-rtl ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u0641\u0647\u0631\u0633\u062a \u0645\u0637\u0627\u0644\u0628<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#%D9%85%D9%82%D8%AF%D9%85%D9%87\" >\u0645\u0642\u062f\u0645\u0647<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#%D8%A2%D9%86%DA%86%D9%87_%D9%85%D8%A7_%DB%8C%D8%A7%D8%AF_%D8%AE%D9%88%D8%A7%D9%87%DB%8C%D9%85_%DA%AF%D8%B1%D9%81%D8%AA\" >\u0622\u0646\u0686\u0647 \u0645\u0627 \u06cc\u0627\u062f \u062e\u0648\u0627\u0647\u06cc\u0645 \u06af\u0631\u0641\u062a<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#1%E2%83%A3_%D8%AA%D9%86%D8%B8%DB%8C%D9%85_%D9%BE%D8%B1%D9%88%DA%98%D9%87\" >1\u20e3 \u062a\u0646\u0638\u06cc\u0645 \u067e\u0631\u0648\u0698\u0647<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#2_%E2%83%A3_%D8%AA%D8%B9%D8%B1%DB%8C%D9%81_%D8%B7%D8%B1%D8%AD_GraphQL\" >2 \u20e3 \u062a\u0639\u0631\u06cc\u0641 \u0637\u0631\u062d GraphQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#3_%E2%83%A3_%D8%AA%D9%86%D8%B8%DB%8C%D9%85_%D8%AD%D9%84_%DA%A9%D9%86%D9%86%D8%AF%D9%87_%D9%87%D8%A7\" >3 \u20e3 \u062a\u0646\u0638\u06cc\u0645 \u062d\u0644 \u06a9\u0646\u0646\u062f\u0647 \u0647\u0627<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#4%E2%83%A3_%D8%A7%D8%AA%D8%B5%D8%A7%D9%84_%D8%A8%D9%87_MongoDB\" >4\u20e3 \u0627\u062a\u0635\u0627\u0644 \u0628\u0647 MongoDB<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#5_%D8%AF%D8%B1_%D8%AD%D8%A7%D9%84_%D8%A7%D8%AC%D8%B1%D8%A7_%D9%88_%D8%A2%D8%B2%D9%85%D8%A7%DB%8C%D8%B4_API\" >5 \u062f\u0631 \u062d\u0627\u0644 \u0627\u062c\u0631\u0627 \u0648 \u0622\u0632\u0645\u0627\u06cc\u0634 API<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/nabfollower.com\/blog\/how-to-build-a-graphql-api-from-scratch-in-nodejs-hlo\/#%D9%BE%D8%A7%DB%8C%D8%A7%D9%86\" >\u067e\u0627\u06cc\u0627\u0646<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%D9%85%D9%82%D8%AF%D9%85%D9%87\"><\/span>\n<p>  \u0645\u0642\u062f\u0645\u0647<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>GraphQL \u0628\u0627 \u0627\u0631\u0627\u0626\u0647 \u0631\u0648\u0634\u06cc \u0627\u0646\u0639\u0637\u0627\u0641 \u067e\u0630\u06cc\u0631 \u0648 \u06a9\u0627\u0631\u0622\u0645\u062f \u0628\u0631\u0627\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627 \u060c \u062a\u0648\u0633\u0639\u0647 API \u0631\u0627 \u0645\u062a\u062d\u0648\u0644 \u06a9\u0631\u062f\u0647 \u0627\u0633\u062a. \u0628\u0631 \u062e\u0644\u0627\u0641 API \u0647\u0627\u06cc REST \u060c \u062c\u0627\u06cc\u06cc \u06a9\u0647 \u0634\u0645\u0627 \u0627\u063a\u0644\u0628 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc \u0631\u0627 \u0648\u0627\u06af\u0630\u0627\u0631 \u0645\u06cc \u06a9\u0646\u06cc\u062f \u06cc\u0627 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641\u06cc \u0631\u0627 \u0627\u0646\u062c\u0627\u0645 \u0645\u06cc \u062f\u0647\u06cc\u062f \u060c GraphQL \u0628\u0647 \u0645\u0634\u062a\u0631\u06cc\u0627\u0646 \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f \u062a\u0627 \u062f\u0642\u06cc\u0642\u0627\u064b \u0622\u0646\u0686\u0647 \u0631\u0627 \u06a9\u0647 \u0644\u0627\u0632\u0645 \u062f\u0627\u0631\u0646\u062f \u062f\u0631 \u06cc\u06a9 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0648\u0627\u062d\u062f \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0646\u0646\u062f.<\/p>\n<p>\u062f\u0631 \u0627\u06cc\u0646 \u0622\u0645\u0648\u0632\u0634 \u060c \u0645\u0627 \u06cc\u06a9 API GraphQL \u0631\u0627 \u0627\u0632 \u0627\u0628\u062a\u062f\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Node.js \u0648 Apollo Server \u0645\u06cc \u0633\u0627\u0632\u06cc\u0645. API \u0645\u0627 \u0628\u0627 \u06a9\u0627\u0631\u0628\u0631\u0627\u0646 \u0648 \u067e\u0633\u062a \u0647\u0627 \u0627\u062f\u0627\u0631\u0647 \u0645\u06cc \u0634\u0648\u062f \u0648 \u0646\u0645\u0648\u0646\u0647 \u0627\u06cc \u0633\u0627\u062e\u062a\u0627\u0631\u06cc \u0627\u0632 \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0648 \u062c\u0647\u0634 \u0647\u0627 \u0631\u0627 \u0627\u0631\u0627\u0626\u0647 \u0645\u06cc \u062f\u0647\u062f.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%D8%A2%D9%86%DA%86%D9%87_%D9%85%D8%A7_%DB%8C%D8%A7%D8%AF_%D8%AE%D9%88%D8%A7%D9%87%DB%8C%D9%85_%DA%AF%D8%B1%D9%81%D8%AA\"><\/span>\n<p>  \u0622\u0646\u0686\u0647 \u0645\u0627 \u06cc\u0627\u062f \u062e\u0648\u0627\u0647\u06cc\u0645 \u06af\u0631\u0641\u062a<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>\u062a\u0646\u0638\u06cc\u0645 \u0633\u0631\u0648\u0631 Node.js GraphQL \u0628\u0627 \u0633\u0631\u0648\u0631 \u0622\u067e\u0648\u0644\u0648<\/li>\n<li>\u062a\u0639\u0631\u06cc\u0641 \u06cc\u06a9 \u0637\u0631\u062d GraphQL (\u0627\u0646\u0648\u0627\u0639 \u060c \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0634\u062f \u0648 \u062c\u0647\u0634)<\/li>\n<li>\u0627\u06cc\u062c\u0627\u062f \u062d\u0644 \u06a9\u0646\u0646\u062f\u0647 \u0628\u0631\u0627\u06cc \u0631\u0633\u06cc\u062f\u06af\u06cc \u0628\u0647 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0647\u0627<\/li>\n<li>\u0627\u062a\u0635\u0627\u0644 \u0628\u0647 MongoDB \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Mongoose<\/li>\n<li>\u0627\u062c\u0631\u0627\u06cc \u0627\u062d\u0631\u0627\u0632 \u0647\u0648\u06cc\u062a JWT<\/li>\n<\/ul>\n<p>\u0622\u067e\u0648\u0644\u0648 \u0686\u06cc\u0633\u062a \u0648 \u0686\u0631\u0627 \u0645\u0627 \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u0627\u0632 \u0622\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645\u061f \u0622\u067e\u0648\u0644\u0648 \u06cc\u06a9 \u0633\u0631\u0648\u0631 \u0645\u062d\u0628\u0648\u0628 GraphQL \u0648 \u06a9\u062a\u0627\u0628\u062e\u0627\u0646\u0647 \u0645\u0634\u062a\u0631\u06cc \u0627\u0633\u062a. \u0645\u0627 \u0627\u0632 \u0633\u0631\u0648\u0631 Apollo \u062f\u0631 Node.js \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645 \u062a\u0627 \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0634\u062f\u06af\u0627\u0646 \u060c \u062c\u0647\u0634 \u0647\u0627 \u0648 \u0627\u0634\u062a\u0631\u0627\u06a9 \u0647\u0627 \u0631\u0627 \u0628\u0647 \u0637\u0648\u0631 \u06a9\u0627\u0631\u0622\u0645\u062f \u0627\u0646\u062c\u0627\u0645 \u062f\u0647\u06cc\u0645 \u0648 \u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc\u06cc \u0645\u0627\u0646\u0646\u062f \u062f\u0648\u062e\u062a \u0637\u0631\u062d\u0648\u0627\u0631\u0647 \u060c \u0630\u062e\u06cc\u0631\u0647 \u0633\u0627\u0632\u06cc \u0648 \u0627\u062f\u063a\u0627\u0645 \u0645\u06cc\u0627\u0646 \u0627\u0641\u0632\u0627\u0631 \u0631\u0627 \u0627\u0631\u0627\u0626\u0647 \u0645\u06cc \u062f\u0647\u06cc\u0645.<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0634\u0631\u0648\u0639 \u06a9\u0646\u06cc\u0645! \ud83d\ude80<\/p>\n<h2><span class=\"ez-toc-section\" id=\"1%E2%83%A3_%D8%AA%D9%86%D8%B8%DB%8C%D9%85_%D9%BE%D8%B1%D9%88%DA%98%D9%87\"><\/span>\n<p>  1\u20e3 \u062a\u0646\u0638\u06cc\u0645 \u067e\u0631\u0648\u0698\u0647<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>node.js \u0631\u0627 \u0646\u0635\u0628 \u06a9\u0646\u06cc\u062f \u0648 \u067e\u0631\u0648\u0698\u0647 \u0631\u0627 \u0622\u063a\u0627\u0632 \u06a9\u0646\u06cc\u062f<br \/>\u0627\u0637\u0645\u06cc\u0646\u0627\u0646 \u062d\u0627\u0635\u0644 \u06a9\u0646\u06cc\u062f \u06a9\u0647 node.js \u0646\u0635\u0628 \u06a9\u0631\u062f\u0647 \u0627\u06cc\u062f. \u0633\u067e\u0633 \u060c \u06cc\u06a9 \u067e\u0631\u0648\u0698\u0647 \u062c\u062f\u06cc\u062f \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>mkdir graphql-blog-api &amp;&amp; cd graphql-blog-api\nnpm init -y\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0648\u0627\u0628\u0633\u062a\u06af\u06cc \u0647\u0627\u06cc \u0645\u0648\u0631\u062f \u0646\u06cc\u0627\u0632 \u0631\u0627 \u0646\u0635\u0628 \u06a9\u0646\u06cc\u062f<br \/>\u0645\u0627 \u0627\u0632 Apollo Server (\u0628\u0631\u0627\u06cc GraphQL) \u060c Express (\u0628\u0631\u0627\u06cc \u0631\u0633\u06cc\u062f\u06af\u06cc \u0628\u0647 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0647\u0627) \u0648 Mongoose (\u0628\u0631\u0627\u06cc MongoDB) \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>npm install express apollo-server-express graphql mongoose jsonwebtoken bcryptjs dotenv cors\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<blockquote>\n<p>\u0686\u0631\u0627 \u0645\u0627 JsonWebtoken \u060c Bcryptjs \u0648 Cors \u0631\u0627 \u0646\u0635\u0628 \u0645\u06cc \u06a9\u0646\u06cc\u0645\u061f<br \/>JsonWebtoken &#8211; \u0628\u0631\u0627\u06cc \u062a\u0623\u06cc\u06cc\u062f \u0627\u0639\u062a\u0628\u0627\u0631 \u0627\u0632 \u0637\u0631\u06cc\u0642 \u0646\u0634\u0627\u0646\u0647 \u0647\u0627\u06cc JWT \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u062f.<br \/>BCRYPTJS &#8211; \u0628\u0631\u0627\u06cc \u0647\u0634\u062f\u0627\u0631 \u0627\u06cc\u0645\u0646 \u0648 \u0645\u0642\u0627\u06cc\u0633\u0647 \u0631\u0645\u0632\u0647\u0627\u06cc \u0639\u0628\u0648\u0631 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u062f.<br \/>CORS-\u0628\u0647 \u0627\u0634\u062a\u0631\u0627\u06a9 \u06af\u0630\u0627\u0631\u06cc \u0645\u0646\u0627\u0628\u0639 \u0645\u062a\u0642\u0627\u0637\u0639 (CORS) \u0627\u0645\u06a9\u0627\u0646 \u067e\u0630\u06cc\u0631 \u0645\u06cc \u0634\u0648\u062f \u0648 \u0628\u0647 API \u0627\u0645\u06a9\u0627\u0646 \u062f\u0633\u062a\u0631\u0633\u06cc \u0627\u0632 \u062d\u0648\u0632\u0647 \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u0645\u06cc \u062f\u0647\u062f.<\/p>\n<\/blockquote>\n<p>\u0628\u0631\u0627\u06cc \u062a\u0648\u0633\u0639\u0647 \u060c Nodemon \u0631\u0627 \u0646\u0635\u0628 \u06a9\u0646\u06cc\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>npm install --save-dev nodemon\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0628\u0633\u062a\u0647 \u0628\u0646\u062f\u06cc \u0631\u0627 \u0628\u0647 \u0631\u0648\u0632 \u06a9\u0646\u06cc\u062f \u062a\u0627 \u0628\u0627\u0631\u06af\u06cc\u0631\u06cc \u062e\u0648\u062f\u06a9\u0627\u0631 \u0631\u0627 \u0641\u0639\u0627\u0644 \u06a9\u0646\u06cc\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\"scripts\": {\n \"dev\": \"nodemon index.js\"\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"2_%E2%83%A3_%D8%AA%D8%B9%D8%B1%DB%8C%D9%81_%D8%B7%D8%B1%D8%AD_GraphQL\"><\/span>\n<p>  2 \u20e3 \u062a\u0639\u0631\u06cc\u0641 \u0637\u0631\u062d GraphQL<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>GraphQL \u0628\u0631\u0627\u06cc \u062a\u0639\u0631\u06cc\u0641 \u0627\u0646\u0648\u0627\u0639 \u0648 \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0628\u0647 \u06cc\u06a9 \u0637\u0631\u062d \u0645\u062a\u06a9\u06cc \u0627\u0633\u062a. \u0628\u06cc\u0627\u06cc\u06cc\u062f \u06cc\u06a9 \u067e\u0631\u0648\u0646\u062f\u0647 schema.js \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u0645:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const { gql } = require(\"apollo-server-express\");\n\/\/ type defines a GraphQL object structure, and typedefs (short for type definitions) collectively define the GraphQL schema, including queries and mutations.\nconst typeDefs = gql`\n    type User {\n        id: ID!\n        name: String!\n        email: String!\n        password: String!\n    }\n    type Post {\n        id: ID!\n        title: String!\n        content: String!\n        authorId: ID!\n        author: User\n    }\n    type Query {\n        users: [User]\n        posts: [Post]\n    }\n    type Mutation {\n        register(name: String!, email: String!, password: String!): User\n        login(email: String!, password: String!): String\n        createPost(title: String!, content: String!): Post\n    }\n`;\nmodule.exports = typeDefs;\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<blockquote>\n<p>GQL \u0686\u06cc\u0633\u062a\u061f<br \/>GQL (TAG GraphQL) \u06cc\u06a9 \u0627\u0644\u06af\u0648\u06cc \u062a\u062d\u062a \u0627\u0644\u0644\u0641\u0638\u06cc \u0627\u0632 \u0622\u067e\u0648\u0644\u0648 \u0627\u0633\u062a \u06a9\u0647 \u062a\u0639\u0627\u0631\u06cc\u0641 \u0637\u0631\u062d\u0648\u0627\u0631\u0647 GraphQL \u0631\u0627 \u062f\u0631 \u06cc\u06a9 AST (\u062f\u0631\u062e\u062a \u0646\u062d\u0648\u06cc \u0627\u0646\u062a\u0632\u0627\u0639\u06cc) \u062a\u062c\u0632\u06cc\u0647 \u0645\u06cc \u06a9\u0646\u062f.<br \/>\u0686\u0647 \u0645\u06cc \u06a9\u0646\u062f! \u0645\u06cc\u0627\u0646\u06af\u06cc\u0646 \u062f\u0631 \u0627\u0646\u0648\u0627\u0639\u061f<br \/>! \u06cc\u06a9 \u0642\u0633\u0645\u062a \u063a\u06cc\u0631 \u0642\u0627\u0628\u0644 \u062a\u0647\u06cc \u0631\u0627 \u0646\u0634\u0627\u0646 \u0645\u06cc \u062f\u0647\u062f \u060c \u0628\u0647 \u0627\u06cc\u0646 \u0645\u0639\u0646\u06cc \u06a9\u0647 \u0627\u06cc\u0646 \u0632\u0645\u06cc\u0646\u0647 \u0628\u0627\u06cc\u062f \u062f\u0627\u0631\u0627\u06cc \u06cc\u06a9 \u0645\u0642\u062f\u0627\u0631 \u0628\u0627\u0634\u062f \u0648 \u0646\u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u062a\u0647\u06cc \u0628\u0627\u0634\u062f.<\/p>\n<\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"3_%E2%83%A3_%D8%AA%D9%86%D8%B8%DB%8C%D9%85_%D8%AD%D9%84_%DA%A9%D9%86%D9%86%D8%AF%D9%87_%D9%87%D8%A7\"><\/span>\n<p>  3 \u20e3 \u062a\u0646\u0638\u06cc\u0645 \u062d\u0644 \u06a9\u0646\u0646\u062f\u0647 \u0647\u0627<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u062d\u0644 \u06a9\u0646\u0646\u062f\u0647 \u0647\u0627 \u0646\u062d\u0648\u0647 \u067e\u0627\u0633\u062e GraphQL \u0628\u0647 \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0648 \u062c\u0647\u0634 \u0647\u0627 \u0631\u0627 \u062a\u0639\u0631\u06cc\u0641 \u0645\u06cc \u06a9\u0646\u0646\u062f. \u0627\u06cc\u062c\u0627\u062f Resolvers.js:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const bcrypt = require(\"bcryptjs\");\nconst jwt = require(\"jsonwebtoken\");\nconst User = require(\"..\/models\/User\");\nconst Post = require(\"..\/models\/Post\");\n\nconst resolvers = {\n  Query: {\n    users: async () =&gt; await User.find(),\n    posts: async () =&gt; await Post.find().populate(\"author\"),\n  },\n\n  Mutation: {\n    register: async (_, { name, email, password }) =&gt; {\n      const hashedPassword = await bcrypt.hash(password, 10);\n      return await User.create({ name, email, password: hashedPassword });\n    },\n\n    login: async (_, { email, password }) =&gt; {\n      const user = await User.findOne({ email });\n      if (!user || !(await bcrypt.compare(password, user.password))) {\n        throw new Error(\"Invalid credentials\");\n      }\n      return jwt.sign({ ...user.toObject() }, process.env.JWT_SECRET, { expiresIn: \"1h\" });\n    },\n    createPost: async (_, { title, content }, { user }) =&gt; {\n      if (!user) throw new Error(\"Authentication required\");\n      const post = Post({ title, content, authorId: user._id });\n      await post.save();\n      return await Post.findById(post._id).populate('author');\n    },\n  },\n};\nmodule.exports = resolvers;\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"4%E2%83%A3_%D8%A7%D8%AA%D8%B5%D8%A7%D9%84_%D8%A8%D9%87_MongoDB\"><\/span>\n<p>  4\u20e3 \u0627\u062a\u0635\u0627\u0644 \u0628\u0647 MongoDB<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0627\u06cc\u062c\u0627\u062f a <code>.env<\/code> \u067e\u0631\u0648\u0646\u062f\u0647 \u0628\u0631\u0627\u06cc \u0630\u062e\u06cc\u0631\u0647 MongoDB URI:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>MONGO_URI=mongodb:\/\/localhost:27017\/graphql_blog\nJWT_SECRET=\"secretKey\"\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06a9\u0646\u0648\u0646 \u060c \u0645\u062f\u0644 \u0647\u0627\/user.js \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const mongoose = require(\"mongoose\");\nconst userSchema = new mongoose.Schema({\n    name: String,\n    email: String,\n    password: String,\n});\nmodule.exports = mongoose.model(\"User\", userSchema);\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0648 \u0645\u062f\u0644 \u0647\u0627\/post.js:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const mongoose = require(\"mongoose\");\nconst postSchema = new mongoose.Schema({\n    title: String,\n    content: String,\n    authorId: { type: mongoose.Schema.Types.ObjectId, ref: \"User\" },\n});\n\npostSchema.virtual('author', {\n    localField: 'authorId',\n    foreignField: '_id',\n    ref: 'User',\n    justOne: true\n})\n\nmodule.exports = mongoose.model(\"Post\", postSchema);\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"5_%D8%AF%D8%B1_%D8%AD%D8%A7%D9%84_%D8%A7%D8%AC%D8%B1%D8%A7_%D9%88_%D8%A2%D8%B2%D9%85%D8%A7%DB%8C%D8%B4_API\"><\/span>\n<p>  5 \u062f\u0631 \u062d\u0627\u0644 \u0627\u062c\u0631\u0627 \u0648 \u0622\u0632\u0645\u0627\u06cc\u0634 API<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0627\u06cc\u062c\u0627\u062f index.js \u0628\u0631\u0627\u06cc \u062a\u0646\u0638\u06cc\u0645 \u0633\u0631\u0648\u0631 \u0622\u067e\u0648\u0644\u0648:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const express = require('express');\nrequire('dotenv').config();\nconst { ApolloServer } = require('apollo-server-express');\nconst mongoose = require('mongoose');\nconst typeDefs = require(\".\/src\/graphql\/schema\");\nconst resolvers = require(\".\/src\/graphql\/resolvers\");\n\nconst app = express();\n\nmongoose.connect(process.env.MONGO_URI)\n  .then(() =&gt; console.log('connected to mongodb'))\n  .catch((err) =&gt; console.log('Not able to connect to mongodb', err));\n\nconst jwt = require('jsonwebtoken');\n\nconst context = ({ req }) =&gt; {\n  const authHeader = req.headers.authorization || '';\n  const token = authHeader.split(' ')[1]; \/\/ Extract token from \"Bearer <token>\"\n\n  if (token) {\n    try {\n      const user = jwt.verify(token, process.env.JWT_SECRET); \/\/ Decode user\n      return { user }; \/\/ Attach user to context\n    } catch (err) {\n      console.log('Invalid Token');\n    }\n  }\n  return {}; \/\/ No user attached if token is missing\/invalid\n};\n\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  context\n});\n\nasync function startServer() {\n  await server.start();\n  server.applyMiddleware({ app });\n\n  \/\/ Start Express Server\n  app.listen(4000, () =&gt; {\n    console.log(`Server running at http:\/\/localhost:4000${server.graphqlPath}`);\n  });\n}\n\nstartServer();\n<\/token><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>API \u0631\u0627 \u0627\u062c\u0631\u0627 \u06a9\u0646\u06cc\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>npm run dev\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u062a\u0633\u062a \u062f\u0631 \u0632\u0645\u06cc\u0646 \u0628\u0627\u0632\u06cc GraphQl \u062f\u0631 <code>http:\/\/localhost:4000\/graphql<\/code>\u0628\u0634\u0631<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%D9%BE%D8%A7%DB%8C%D8%A7%D9%86\"><\/span>\n<p>  \u067e\u0627\u06cc\u0627\u0646<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\ud83c\udf89 \u0634\u0645\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Node.js \u060c Apollo Server \u0648 MongoDB \u06cc\u06a9 API GraphQL \u0631\u0627 \u0627\u0632 \u0627\u0628\u062a\u062f\u0627 \u0633\u0627\u062e\u062a\u0647 \u0627\u06cc\u062f. \u0634\u0645\u0627 \u06cc\u0627\u062f \u06af\u0631\u0641\u062a\u06cc\u062f:<br \/>\u2705 \u0646\u062d\u0648\u0647 \u062a\u0639\u0631\u06cc\u0641 \u06cc\u06a9 \u0637\u0631\u062d\u0648\u0627\u0631\u0647 GraphQL<br \/>\u2705 \u0646\u062d\u0648\u0647 \u062a\u0646\u0638\u06cc\u0645 \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0648 \u062c\u0647\u0634 \u0647\u0627<br \/>\u2705 \u0646\u062d\u0648\u0647 \u0627\u062a\u0635\u0627\u0644 \u0628\u0647 MongoDB<br \/>\u2705 \u0646\u062d\u0648\u0647 \u062a\u0623\u06cc\u06cc\u062f \u0627\u0639\u062a\u0628\u0627\u0631 \u06a9\u0627\u0631\u0628\u0631\u0627\u0646<\/p>\n<p>\u0645\u0631\u0627\u062d\u0644 \u0628\u0639\u062f\u06cc: \u0627\u0634\u062a\u0631\u0627\u06a9 \u0647\u0627 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0628\u0647 \u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06cc \u0647\u0627\u06cc \u0632\u0645\u0627\u0646 \u0648\u0627\u0642\u0639\u06cc \u0627\u0636\u0627\u0641\u0647 \u06a9\u0646\u06cc\u062f \u06cc\u0627 \u06cc\u06a9 Frontend React \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f!<\/p>\n<p>\ud83d\ude80 \u062f\u0648\u0633\u062a \u062f\u0627\u0631\u06cc\u062f \u0628\u0639\u062f \u0686\u0647 \u0686\u06cc\u0632\u06cc \u0628\u06cc\u0627\u0645\u0648\u0632\u06cc\u062f\u061f \u0646\u0638\u0631 \u0632\u06cc\u0631 \u0631\u0627 \u0631\u0647\u0627 \u06a9\u0646\u06cc\u062f!<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0645\u0642\u062f\u0645\u0647 GraphQL \u0628\u0627 \u0627\u0631\u0627\u0626\u0647 \u0631\u0648\u0634\u06cc \u0627\u0646\u0639\u0637\u0627\u0641 \u067e\u0630\u06cc\u0631 \u0648 \u06a9\u0627\u0631\u0622\u0645\u062f \u0628\u0631\u0627\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627 \u060c \u062a\u0648\u0633\u0639\u0647 API \u0631\u0627 \u0645\u062a\u062d\u0648\u0644 \u06a9\u0631\u062f\u0647 \u0627\u0633\u062a. \u0628\u0631 \u062e\u0644\u0627\u0641 API \u0647\u0627\u06cc REST \u060c \u062c\u0627\u06cc\u06cc \u06a9\u0647 \u0634\u0645\u0627 \u0627\u063a\u0644\u0628 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc \u0631\u0627 \u0648\u0627\u06af\u0630\u0627\u0631 \u0645\u06cc \u06a9\u0646\u06cc\u062f \u06cc\u0627 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641\u06cc \u0631\u0627 \u0627\u0646\u062c\u0627\u0645 \u0645\u06cc \u062f\u0647\u06cc\u062f \u060c GraphQL \u0628\u0647 \u0645\u0634\u062a\u0631\u06cc\u0627\u0646 \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc &hellip;<\/p>\n","protected":false},"author":2,"featured_media":95696,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-95695","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/95695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=95695"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/95695\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/95696"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=95695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=95695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=95695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}