{"id":26491,"date":"2026-07-09T20:43:24","date_gmt":"2026-07-09T20:43:24","guid":{"rendered":"https:\/\/umang.pk\/2026\/07\/09\/jwt-%da%a9%d8%a7-%d8%a7%d8%b3%d8%aa%d8%b9%d9%85%d8%a7%d9%84-%da%a9%d8%b1%d8%aa%db%92-%db%81%d9%88%d8%a6%db%92-node-js-rest-api-%d9%85%db%8c%da%ba-%d8%b1%d9%88%d9%84-%d9%be%d8%b1-%d9%85%d8%a8%d9%86\/"},"modified":"2026-07-09T20:43:24","modified_gmt":"2026-07-09T20:43:24","slug":"jwt-%da%a9%d8%a7-%d8%a7%d8%b3%d8%aa%d8%b9%d9%85%d8%a7%d9%84-%da%a9%d8%b1%d8%aa%db%92-%db%81%d9%88%d8%a6%db%92-node-js-rest-api-%d9%85%db%8c%da%ba-%d8%b1%d9%88%d9%84-%d9%be%d8%b1-%d9%85%d8%a8%d9%86","status":"publish","type":"post","link":"https:\/\/umang.pk\/en_us\/2026\/07\/09\/jwt-%da%a9%d8%a7-%d8%a7%d8%b3%d8%aa%d8%b9%d9%85%d8%a7%d9%84-%da%a9%d8%b1%d8%aa%db%92-%db%81%d9%88%d8%a6%db%92-node-js-rest-api-%d9%85%db%8c%da%ba-%d8%b1%d9%88%d9%84-%d9%be%d8%b1-%d9%85%d8%a8%d9%86\/","title":{"rendered":"JWT \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 Node.js REST API \u0645\u06cc\u06ba \u0631\u0648\u0644 \u067e\u0631 \u0645\u0628\u0646\u06cc \u0631\u0633\u0627\u0626\u06cc \u06a9\u0646\u0679\u0631\u0648\u0644 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0646\u0627\u0641\u0630 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4"},"content":{"rendered":"\n<div id=\"\">\n<p>\u062c\u0628 \u0645\u06cc\u06ba \u0646\u06d2 \u0631\u0648\u0644\u0632 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0633\u0648\u0686\u06d2 \u0628\u063a\u06cc\u0631 \u0627\u067e\u0646\u0627 API \u0628\u0646\u0627\u06cc\u0627 \u062a\u0648 \u0645\u06cc\u06ba \u0646\u06d2 \u062a\u0645\u0627\u0645 \u0644\u0627\u06af \u0627\u0646 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0648 \u06cc\u06a9\u0633\u0627\u06ba \u0631\u0633\u0627\u0626\u06cc \u062f\u06cc\u06d4 \u0627\u0633 \u0646\u06d2 \u0627\u0633 \u0648\u0642\u062a \u062a\u06a9 \u0679\u06be\u06cc\u06a9 \u06a9\u0627\u0645 \u06a9\u06cc\u0627 \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u0627\u06cc\u06a9 \u0639\u0627\u0645 \u0635\u0627\u0631\u0641 \u063a\u0644\u0637\u06cc \u0633\u06d2 \u0688\u06cc\u0644\u06cc\u0679 \u0627\u06cc\u0646\u0688 \u067e\u0648\u0627\u0626\u0646\u0679 \u06a9\u0648 \u0646\u06c1\u06cc\u06ba \u0645\u0627\u0631\u062a\u0627 \u0627\u0648\u0631 \u0679\u06cc\u0633\u0679 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0645\u0679\u0627 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0648\u06c1 \u062f\u0646 \u062a\u06be\u0627 \u062c\u0628 \u0645\u06cc\u06ba \u0648\u0627\u0642\u0639\u062a\u0627\u064b \u0628\u06cc\u0679\u06be \u06af\u06cc\u0627 \u0627\u0648\u0631 RBAC \u06a9\u0648 \u0635\u062d\u06cc\u062d \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0633\u06cc\u06a9\u06be\u0627\u06d4<\/p>\n<p>\u06a9\u0631\u062f\u0627\u0631 \u067e\u0631 \u0645\u0628\u0646\u06cc \u0631\u0633\u0627\u0626\u06cc \u06a9\u0646\u0679\u0631\u0648\u0644 \u062e\u06cc\u0627\u0644\u06cc \u0644\u06af\u062a\u0627 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u062e\u06cc\u0627\u0644 \u0622\u0633\u0627\u0646 \u06c1\u06d2\u06d4 \u0622\u067e \u06a9\u06cc\u0627 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0633 \u067e\u0631 \u0645\u0646\u062d\u0635\u0631 \u06c1\u06d2: <em>\u062a\u0645 \u06a9\u0648\u0646 \u06c1\u0648\u061f<\/em>\u06c1\u0627\u06ba <em>\u06a9\u06c1 \u0622\u067e \u0646\u06d2 \u0644\u0627\u06af \u0627\u0646 \u06a9\u06cc\u0627 \u06c1\u06d2\u06d4<\/em>. \u0645\u0646\u062a\u0638\u0645 \u0635\u0627\u0631\u0641 \u06a9\u0648 \u062d\u0630\u0641 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06cc\u0688\u06cc\u0679\u0631\u0632 \u067e\u0648\u0633\u0679 \u0644\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0639\u0627\u0645 \u0635\u0627\u0631\u0641\u06cc\u0646 \u0635\u0631\u0641 \u067e\u0691\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u06cc\u06a9 \u06c1\u06cc \u0627\u06cc\u067e\u060c \u0628\u0627\u0644\u06a9\u0644 \u0645\u062e\u062a\u0644\u0641 \u062a\u062c\u0631\u0628\u06c1 \u0627\u0633 \u0628\u0627\u062a \u067e\u0631 \u0645\u0646\u062d\u0635\u0631 \u06c1\u06d2 \u06a9\u06c1 \u06a9\u0648\u0646 \u067e\u0648\u0686\u06be\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u06cc\u06c1 \u0648\u06c1\u06cc \u06c1\u06d2 \u062c\u0648 \u06c1\u0645 \u06cc\u06c1\u0627\u06ba \u062a\u062e\u0644\u06cc\u0642 \u06a9\u0631 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u06cc\u06a9 REST API \u062c\u0633 \u0645\u06cc\u06ba \u062a\u06cc\u0646 \u06a9\u0631\u062f\u0627\u0631 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba: \u0627\u06cc\u06a9 JWT \u062c\u0648 \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633 \u06a9\u0631\u062f\u0627\u0631 \u06a9\u0648 \u0627\u0646\u062c\u0627\u0645 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u0641\u0646\u06a9\u0634\u0646\u0632 \u06a9\u0627 \u0627\u06cc\u06a9 \u062c\u0648\u0691\u0627 \u062c\u0648 \u0631\u0648\u0679 \u06c1\u06cc\u0646\u0688\u0644\u0631 \u067e\u0631 \u0639\u0645\u0644 \u062f\u0631\u0622\u0645\u062f \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u062c\u0627\u0632\u062a\u0648\u06ba \u06a9\u06cc \u062c\u0627\u0646\u0686 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0641\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0648\u0626\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06c1\u0679 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u0627\u0648\u0631 \u0622\u067e \u06a9\u06cc \u06a9\u0627\u0631\u0648\u0628\u0627\u0631\u06cc \u0645\u0646\u0637\u0642 \u0645\u06cc\u06ba \u06a9\u0648\u0626\u06cc if\/else \u0633\u0648\u067e \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<p>\u0622\u062e\u0631 \u0645\u06cc\u06ba\u060c \u062a\u06cc\u0646 \u06a9\u0627\u0645 \u06a9\u06d2 \u06a9\u0631\u062f\u0627\u0631 (<code>admin<\/code>\u060c <code>editor<\/code>\u060c <code>user<\/code>) \u06c1\u0631 \u0627\u06cc\u06a9 \u0627\u067e\u0646\u06d2 \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u06c1 \u067e\u0631 \u0628\u0646\u062f \u06c1\u06d2\u06d4 \u0632\u06cc\u0627\u062f\u06c1 \u0627\u06c1\u0645 \u0628\u0627\u062a \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u067e\u06cc\u0679\u0631\u0646 \u0642\u0627\u0628\u0644 \u0645\u0646\u062a\u0642\u0644\u06cc \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u0628\u0627\u0631 \u062c\u0628 \u0622\u067e \u0627\u0633 \u067e\u0631 \u06a9\u0644\u06a9 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u0622\u067e \u0628\u063a\u06cc\u0631 \u06a9\u0633\u06cc \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u06a9\u06d2 \u0627\u067e\u0646\u06d2 \u0627\u06af\u0644\u06d2 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0633\u06d2 \u062c\u0691 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p><strong>GitHub \u067e\u0631 \u0645\u06a9\u0645\u0644 \u0633\u0648\u0631\u0633 \u06a9\u0648\u0688:<\/strong> github.com\/ziaongit\/nodejs-rbac-jwt-api<\/p>\n<h2 id=\"heading-table-of-contents\">\u0627\u0646\u0688\u06cc\u06a9\u0633<\/h2>\n<h2 id=\"heading-what-youll-learn\">\u062c\u0648 \u0622\u067e \u0633\u06cc\u06a9\u06be\u06cc\u06ba \u06af\u06d2\u06d4<\/h2>\n<ul>\n<li>\n<p>RBAC \u06a9\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u06cc\u06c1 \u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0633\u06d2 \u06a9\u06cc\u0633\u06d2 \u0645\u062e\u062a\u0644\u0641 \u06c1\u06d2\u061f<\/p>\n<\/li>\n<li>\n<p>JWT \u067e\u06d2 \u0644\u0648\u0688 \u0645\u06cc\u06ba \u06a9\u0631\u062f\u0627\u0631 \u06a9\u06cc\u0633\u06d2 \u0634\u0627\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0679\u0648\u06a9\u0646 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0627\u0648\u0631 \u06a9\u0631\u062f\u0627\u0631 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0642\u0627\u0628\u0644 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0627\u06cc\u06a9\u0633\u067e\u0631\u06cc\u0633 \u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u06a9\u06cc\u0633\u06d2 \u0644\u06a9\u06be\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0635\u0627\u0631\u0641 \u06a9\u06d2 \u06a9\u0631\u062f\u0627\u0631 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u067e\u0631 API \u0631\u0648\u0679\u0633 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0645\u062d\u0641\u0648\u0638 \u0628\u0646\u0627\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4<\/p>\n<\/li>\n<\/ul>\n<h2 id=\"heading-prerequisites\">\u0634\u0631\u0637\u06cc\u06ba<\/h2>\n<h2 id=\"heading-what-well-build\">\u062c\u0648 \u06c1\u0645 \u062a\u0639\u0645\u06cc\u0631 \u06a9\u0631\u06cc\u06ba \u06af\u06d2\u06d4<\/h2>\n<p>\u0622\u0626\u06cc\u06d2 \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u062a\u06cc\u0646 \u06a9\u0631\u062f\u0627\u0631\u0648\u06ba \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u06cc\u06a9 \u0633\u0627\u062f\u06c1 \u0645\u0648\u0627\u062f \u06a9\u06d2 \u0627\u0646\u062a\u0638\u0627\u0645 \u06a9\u06d2 \u0646\u0638\u0627\u0645 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 REST API \u0628\u0646\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<table>\n<thead>\n<tr>\n<th>\u06a9\u0631\u062f\u0627\u0631<\/th>\n<th>\u0627\u062a\u06be\u0627\u0631\u0679\u06cc<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>user<\/code><\/td>\n<td>\u0645\u0648\u0627\u062f \u067e\u0691\u06be\u06cc\u06ba<\/td>\n<\/tr>\n<tr>\n<td><code>editor<\/code><\/td>\n<td>\u067e\u0691\u06be\u06cc\u06ba + \u0645\u0648\u0627\u062f \u0628\u0646\u0627\u0626\u06cc\u06ba<\/td>\n<\/tr>\n<tr>\n<td><code>admin<\/code><\/td>\n<td>\u0645\u06a9\u0645\u0644 \u0631\u0633\u0627\u0626\u06cc \u2014 \u067e\u0691\u06be\u06cc\u06ba\u060c \u062a\u062e\u0644\u06cc\u0642 \u06a9\u0631\u06cc\u06ba\u060c \u0645\u0648\u0627\u062f \u062d\u0630\u0641 \u06a9\u0631\u06cc\u06ba\u060c \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0627 \u0646\u0638\u0645 \u06a9\u0631\u06cc\u06ba\u06d4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>API \u0645\u0646\u062f\u0631\u062c\u06c1 \u0630\u06cc\u0644 \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u06a9\u0627\u062a \u06a9\u0648 \u0628\u06d2 \u0646\u0642\u0627\u0628 \u06a9\u0631\u062a\u0627 \u06c1\u06d2:<\/p>\n<table>\n<thead>\n<tr>\n<th>\u0637\u0631\u06cc\u0642\u06c1<\/th>\n<th>\u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u06c1<\/th>\n<th>\u067e\u0648\u0632\u06cc\u0634\u0646<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0645\u06cc\u0644<\/td>\n<td>\/api\/authenticate\/register<\/td>\n<td>\u0639\u0648\u0627\u0645\u06cc<\/td>\n<\/tr>\n<tr>\n<td>\u0645\u06cc\u0644<\/td>\n<td>\/api\/authenticate\/login<\/td>\n<td>\u0639\u0648\u0627\u0645\u06cc<\/td>\n<\/tr>\n<tr>\n<td>\u062d\u0627\u0635\u0644 \u06a9\u0631\u06cc\u06ba<\/td>\n<td>\/api\/content<\/td>\n<td>\u0635\u0627\u0631\u0641\u06cc\u0646\u060c \u0627\u06cc\u0688\u06cc\u0679\u0631\u0632\u060c \u0645\u0646\u062a\u0638\u0645\u06cc\u0646<\/td>\n<\/tr>\n<tr>\n<td>\u0645\u06cc\u0644<\/td>\n<td>\/api\/content<\/td>\n<td>\u0627\u06cc\u0688\u06cc\u0679\u0631\u060c \u0627\u06cc\u0688\u0645\u0646\u0633\u0679\u0631\u06cc\u0679\u0631<\/td>\n<\/tr>\n<tr>\n<td>\u062d\u0630\u0641 \u06a9\u0631\u06cc\u06ba<\/td>\n<td>\/api\/content\/:id<\/td>\n<td>\u0635\u0631\u0641 \u0627\u06cc\u0688\u0645\u0646\u0633\u0679\u0631\u06cc\u0679\u0631<\/td>\n<\/tr>\n<tr>\n<td>\u062d\u0627\u0635\u0644 \u06a9\u0631\u06cc\u06ba<\/td>\n<td>\/api\/administrator\/user<\/td>\n<td>\u0635\u0631\u0641 \u0627\u06cc\u0688\u0645\u0646\u0633\u0679\u0631\u06cc\u0679\u0631<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"heading-project-setup\">\u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u06cc \u062a\u0631\u062a\u06cc\u0628\u0627\u062a<\/h2>\n<p>\u0627\u06cc\u06a9 \u0646\u06cc\u0627 \u0641\u0648\u0644\u0688\u0631 \u0628\u0646\u0627\u0626\u06cc\u06ba \u0627\u0648\u0631 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u0648 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-bash\">mkdir nodejs-rbac-jwt-api\ncd nodejs-rbac-jwt-api\nnpm init -y\n<\/code><\/pre>\n<p>\u0627\u0646\u062d\u0635\u0627\u0631 \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-bash\">npm install express jsonwebtoken bcryptjs dotenv\nnpm install --save-dev nodemon\n<\/code><\/pre>\n<p>\u06c1\u0631 \u067e\u06cc\u06a9\u062c \u06a9\u06cc \u062e\u0635\u0648\u0635\u06cc\u0627\u062a \u062f\u0631\u062c \u0630\u06cc\u0644 \u06c1\u06cc\u06ba:<\/p>\n<ul>\n<li>\n<p><strong>\u0627\u0638\u06c1\u0627\u0631<\/strong>: API \u06a9\u06cc \u062a\u0639\u0645\u06cc\u0631 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0648\u06cc\u0628 \u0641\u0631\u06cc\u0645 \u0648\u0631\u06a9<\/p>\n<\/li>\n<li>\n<p><strong>jsonwebtoken<\/strong>: JWT \u0628\u0646\u0627\u0626\u06cc\u06ba \u0627\u0648\u0631 \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>bcryptjs<\/strong>: \u067e\u0627\u0633 \u0648\u0631\u0688 \u06a9\u0648 \u0645\u062d\u0641\u0648\u0638 \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u06c1\u06cc\u0634 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>Dotenb<\/strong>: \u0627\u067e\u0646\u0627 \u0645\u0648\u0627\u062f \u067e\u0691\u06be\u06cc\u06ba <code>.env<\/code> \u0641\u0627\u0626\u0644 \u06a9\u0648 \u0645\u062d\u0641\u0648\u0638 \u06a9\u0631\u06cc\u06ba \u062a\u0627\u06a9\u06c1 \u0622\u067e \u0627\u067e\u0646\u06d2 \u0633\u0648\u0631\u0633 \u06a9\u0648\u0688 \u0645\u06cc\u06ba \u0631\u0627\u0632 \u06a9\u0648 \u06c1\u0627\u0631\u0688 \u06a9\u0648\u0688 \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<\/ul>\n<p>\u0627\u067e \u0688\u06cc\u0679 <code>package.json<\/code> \u0627\u0633\u0679\u0627\u0631\u0679 \u0627\u067e \u0627\u0633\u06a9\u0631\u067e\u0679 \u0634\u0627\u0645\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2:<\/p>\n<pre><code class=\"language-json\">\"scripts\": {\n  \"start\": \"node src\/app.js\",\n  \"dev\": \"nodemon src\/app.js\"\n}\n<\/code><\/pre>\n<p>\u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u0627 \u0688\u06be\u0627\u0646\u0686\u06c1 \u0628\u0646\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">nodejs-rbac-jwt-api\/\n\u251c\u2500\u2500 src\/\n\u2502   \u251c\u2500\u2500 middleware\/\n\u2502   \u2502   \u2514\u2500\u2500 auth.js\n\u2502   \u251c\u2500\u2500 routes\/\n\u2502   \u2502   \u251c\u2500\u2500 auth.js\n\u2502   \u2502   \u251c\u2500\u2500 content.js\n\u2502   \u2502   \u2514\u2500\u2500 admin.js\n\u2502   \u251c\u2500\u2500 data\/\n\u2502   \u2502   \u2514\u2500\u2500 users.js\n\u2502   \u2514\u2500\u2500 app.js\n\u251c\u2500\u2500 .env\n\u251c\u2500\u2500 .env.example\n\u2514\u2500\u2500 package.json\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u0627 <code>.env<\/code> \u0641\u0627\u0626\u0644:<\/p>\n<pre><code class=\"language-plaintext\">JWT_SECRET=your_super_secret_key_change_this_in_production\nPORT=3000\n<\/code><\/pre>\n<p><strong>\u0627\u06c1\u0645:<\/strong> \u06a9\u0628\u06be\u06cc \u0639\u06c1\u062f \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4 <code>.env<\/code> \u0641\u0627\u0626\u0644 \u06a9\u0648 \u0648\u0631\u0698\u0646 \u06a9\u0646\u0679\u0631\u0648\u0644 \u067e\u0631 \u0628\u06be\u06cc\u062c\u06cc\u06ba\u06d4 \u0627\u0633\u06d2 \u0627\u06af\u0644\u06cc \u0628\u0627\u0631 \u0634\u0627\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 <code>.gitignore<\/code>.<\/p>\n<h2 id=\"heading-setting-up-the-in-memory-data-store\">\u0627\u0646 \u0645\u06cc\u0645\u0648\u0631\u06cc \u0688\u06cc\u0679\u0627 \u0627\u0633\u0679\u0648\u0631\u06cc\u062c \u06a9\u0648 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0646\u0627<\/h2>\n<p>\u06cc\u06c1\u0627\u06ba \u06a9\u0648\u0626\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u060c \u0635\u0631\u0641 \u0645\u06cc\u0645\u0648\u0631\u06cc \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0635\u0641 \u06c1\u06d2\u06d4 \u0646\u0642\u0637\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062a\u0631\u062a\u06cc\u0628 \u067e\u0631 \u0646\u0635\u0641 \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u062e\u0631\u0686 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 RBAC \u067e\u0631 \u062a\u0648\u062c\u06c1 \u0645\u0631\u06a9\u0648\u0632 \u06a9\u0631\u0646\u0627 \u062a\u06be\u0627\u06d4 \u0627\u0635\u0644\u06cc \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679\u0633 \u0645\u06cc\u06ba\u060c \u0635\u0641 \u06a9\u0648 \u0627\u0633 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0633\u06d2 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u06cc\u06ba \u062c\u0633\u06d2 \u0622\u067e \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0628\u0646\u0627\u0646\u0627 <code>src\/data\/users.js<\/code>:<\/p>\n<pre><code class=\"language-javascript\">\/\/ In-memory users store\n\/\/ In production, replace this with a real database (MongoDB, PostgreSQL, etc.)\nconst users = [];\n\nconst findUserByEmail = (email) => users.find((u) => u.email === email);\nconst findUserById = (id) => users.find((u) => u.id === id);\nconst createUser = (user) => {\n  users.push(user);\n  return user;\n};\nconst getAllUsers = () => users.map(({ password, ...user }) => user);\n\nmodule.exports = { findUserByEmail, findUserById, createUser, getAllUsers };\n<\/code><\/pre>\n<p>\u0627\u06cc\u06a9 \u0628\u0627\u062a \u0642\u0627\u0628\u0644 \u063a\u0648\u0631 \u06c1\u06d2: <code>getAllUsers<\/code> \u06a9\u0686\u06be \u0628\u06be\u06cc \u0648\u0627\u067e\u0633 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u06c1\u0645 \u067e\u0627\u0633 \u0648\u0631\u0688 \u06a9\u0648 \u0636\u0627\u0626\u0639 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0688\u06cc\u0633\u0679\u0631\u06a9\u0686\u0631\u0646\u06af \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 API \u06a9\u06d2 \u062c\u0648\u0627\u0628\u0627\u062a \u0645\u06cc\u06ba \u067e\u0627\u0633 \u0648\u0631\u0688 \u0641\u06cc\u0644\u0688\u0632 \u0646\u06c1 \u0628\u06be\u06cc\u062c\u06cc\u06ba\u060c \u062d\u062a\u06cc\u0670 \u06a9\u06c1 \u06c1\u06cc\u0634\u0688 \u062c\u0648\u0627\u0628\u0627\u062a \u0628\u06be\u06cc\u06d4<\/p>\n<h2 id=\"heading-building-the-auth-routes\">\u0633\u0631\u0679\u06cc\u0641\u06cc\u06a9\u06cc\u0634\u0646 \u06a9\u0627 \u0631\u0627\u0633\u062a\u06c1 \u0628\u0646\u0627\u0646\u0627<\/h2>\n<p>\u062a\u0635\u062f\u06cc\u0642 \u06a9\u0627 \u0631\u0627\u0633\u062a\u06c1 \u0631\u062c\u0633\u0679\u0631\u06cc\u0634\u0646 \u0627\u0648\u0631 \u0644\u0627\u06af \u0627\u0646 \u06a9\u0648 \u0633\u0646\u0628\u06be\u0627\u0644\u062a\u0627 \u06c1\u06d2\u06d4 \u0644\u0627\u06af \u0627\u0646 \u0648\u06c1 \u062c\u06af\u06c1 \u06c1\u06d2 \u062c\u06c1\u0627\u06ba \u067e\u06c1\u0644\u06d2 \u06a9\u0631\u062f\u0627\u0631 \u0627\u062f\u0627 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 JWT \u067e\u06d2 \u0644\u0648\u0688 \u0645\u06cc\u06ba \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u06a9\u0631\u062f\u0627\u0631 \u06a9\u0648 \u0634\u0627\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p>\u0628\u0646\u0627\u0646\u0627 <code>src\/routes\/auth.js<\/code>:<\/p>\n<pre><code class=\"language-javascript\">const express = require('express');\nconst bcrypt = require('bcryptjs');\nconst jwt = require('jsonwebtoken');\nconst { findUserByEmail, createUser } = require('..\/data\/users');\n\nconst router = express.Router();\n\n\/\/ POST \/api\/auth\/register\nrouter.post('\/register', async (req, res) => {\n  const { name, email, password, role } = req.body;\n\n  if (!name || !email || !password) {\n    return res.status(400).json({ message: 'Name, email, and password are required' });\n  }\n\n  if (findUserByEmail(email)) {\n    return res.status(409).json({ message: 'Email already registered' });\n  }\n\n  \/\/ Only allow valid roles \u2014 default to 'user' if none provided\n  const validRoles = ['user', 'editor', 'admin'];\n  const assignedRole = validRoles.includes(role) ? role : 'user';\n\n  const hashedPassword = await bcrypt.hash(password, 10);\n\n  const newUser = {\n    id: Date.now().toString(),\n    name,\n    email,\n    password: hashedPassword,\n    role: assignedRole,\n  };\n\n  createUser(newUser);\n\n  res.status(201).json({\n    message: 'User registered successfully',\n    user: {\n      id: newUser.id,\n      name: newUser.name,\n      email: newUser.email,\n      role: newUser.role,\n    },\n  });\n});\n\n\/\/ POST \/api\/auth\/login\nrouter.post('\/login', async (req, res) => {\n  const { email, password } = req.body;\n\n  if (!email || !password) {\n    return res.status(400).json({ message: 'Email and password are required' });\n  }\n\n  const user = findUserByEmail(email);\n  if (!user) {\n    return res.status(401).json({ message: 'Invalid credentials' });\n  }\n\n  const isMatch = await bcrypt.compare(password, user.password);\n  if (!isMatch) {\n    return res.status(401).json({ message: 'Invalid credentials' });\n  }\n\n  \/\/ Issue JWT \u2014 embed role in the payload\n  const token = jwt.sign(\n    {\n      id: user.id,\n      email: user.email,\n      role: user.role,   \/\/ \u2190 This is the key part for RBAC\n    },\n    process.env.JWT_SECRET,\n    { expiresIn: '24h' }\n  );\n\n  res.json({\n    message: 'Login successful',\n    token,\n  });\n});\n\nmodule.exports = router;\n<\/code><\/pre>\n<p>\u0633\u0628 \u0633\u06d2 \u0627\u06c1\u0645 \u0644\u0627\u0626\u0646 JWT \u067e\u06d2 \u0644\u0648\u0688 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-javascript\">jwt.sign({ id, email, role }, process.env.JWT_SECRET, { expiresIn: '24h' })\n<\/code><\/pre>\n<p>\u0688\u0627\u0644 \u06a9\u0631 <code>role<\/code> \u0679\u0648\u06a9\u0646 \u0633\u06d2 \u0622\u0646\u06d2 \u0648\u0627\u0644\u06cc \u062a\u0645\u0627\u0645 \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u06cc\u06ba \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u0635\u0627\u0631\u0641 \u06a9\u06cc \u0627\u062c\u0627\u0632\u062a \u0644\u06d2 \u06a9\u0631 \u062c\u0627\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u0633\u0631\u0648\u0631 \u0679\u0648\u06a9\u0646 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u067e\u06d2 \u0644\u0648\u0688 \u0633\u06d2 \u0631\u0648\u0644 \u067e\u0691\u06be\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-building-the-rbac-middleware\">RBAC \u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u06a9\u06cc \u062a\u0639\u0645\u06cc\u0631<\/h2>\n<p>\u06cc\u06c1 \u0646\u0638\u0627\u0645 \u06a9\u0627 \u0628\u0646\u06cc\u0627\u062f\u06cc \u062d\u0635\u06c1 \u06c1\u06d2\u06d4 \u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u06a9\u06d2 \u062f\u0648 \u0627\u0644\u06af \u0627\u0644\u06af \u0641\u0646\u06a9\u0634\u0646\u0632 \u062f\u0631\u06a9\u0627\u0631 \u06c1\u06cc\u06ba\u06d4<\/p>\n<ol>\n<li>\n<p><code>verifyToken<\/code>    \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u0622\u06cc\u0627 JWT \u062f\u0631\u0633\u062a \u06c1\u06d2 \u0627\u0648\u0631 \u0688\u06cc \u06a9\u0648\u0688 \u0634\u062f\u06c1 \u067e\u06d2 \u0644\u0648\u0688 \u0628\u06be\u06cc\u062c\u06cc\u06ba\u06d4 <code>req.user<\/code><\/p>\n<\/li>\n<li>\n<p><code>checkRole<\/code>    \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u067e\u0627\u0633 \u0645\u062e\u0635\u0648\u0635 \u0631\u0627\u0633\u062a\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u0637\u0644\u0648\u0628\u06c1 \u06a9\u0631\u062f\u0627\u0631 \u06c1\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<\/ol>\n<p>\u0627\u0646\u06c1\u06cc\u06ba \u0627\u0644\u06af \u0631\u06a9\u06be\u0646\u0627 \u0644\u0686\u06a9 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06a9\u0686\u06be \u0631\u0627\u0633\u062a\u0648\u06ba \u06a9\u0648 \u0635\u0631\u0641 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u062f\u0648\u0633\u0631\u0648\u06ba \u06a9\u0648 \u062a\u0648\u062b\u06cc\u0642 \u0627\u0648\u0631 \u0645\u062e\u0635\u0648\u0635 \u06a9\u0631\u062f\u0627\u0631 \u062f\u0648\u0646\u0648\u06ba \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u0628\u0646\u0627\u0646\u0627 <code>src\/middleware\/auth.js<\/code>:<\/p>\n<pre><code class=\"language-javascript\">const jwt = require('jsonwebtoken');\n\n\/\/ Middleware 1: Verify the JWT token\nconst verifyToken = (req, res, next) => {\n  const authHeader = req.headers['authorization'];\n  const token = authHeader && authHeader.split(' ')[1]; \/\/ Expects: Bearer <token>\n\n  if (!token) {\n    return res.status(401).json({ message: 'Access denied. No token provided.' });\n  }\n\n  try {\n    const decoded = jwt.verify(token, process.env.JWT_SECRET);\n    req.user = decoded; \/\/ Attach decoded payload (including role) to request\n    next();\n  } catch (err) {\n    return res.status(403).json({ message: 'Invalid or expired token.' });\n  }\n};\n\n\/\/ Middleware 2: Check if user has one of the required roles\nconst checkRole = (...allowedRoles) => {\n  return (req, res, next) => {\n    if (!req.user) {\n      return res.status(401).json({ message: 'Not authenticated.' });\n    }\n\n    if (!allowedRoles.includes(req.user.role)) {\n      return res.status(403).json({\n        message: `Access denied. Required role: ${allowedRoles.join(' or ')}. Your role: ${req.user.role}`,\n      });\n    }\n\n    next();\n  };\n};\n\nmodule.exports = { verifyToken, checkRole };\n<\/token><\/code><\/pre>\n<p><code>checkRole<\/code>    \u0628\u0627\u0642\u06cc \u067e\u06cc\u0631\u0627\u0645\u06cc\u0679\u0631\u0632 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba (<code>...allowedRoles<\/code>) \u0627\u06cc\u06a9 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u06a9\u0631\u062f\u0627\u0631 \u067e\u0627\u0633 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-javascript\">checkRole('admin')                  \/\/ only admin\ncheckRole('editor', 'admin')        \/\/ editor or admin\ncheckRole('user', 'editor', 'admin') \/\/ all roles\n<\/code><\/pre>\n<p>\u06cc\u06c1 \u0631\u0627\u0633\u062a\u06d2 \u06a9\u06cc \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0648 \u0635\u0627\u0641 \u0627\u0648\u0631 \u067e\u0691\u06be\u0646\u06d2 \u0645\u06cc\u06ba \u0622\u0633\u0627\u0646 \u0628\u0646\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u0627\u062c\u0627\u0632\u062a\u06cc\u06ba \u0631\u0627\u0633\u062a\u06d2 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u0638\u0627\u06c1\u0631 \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-building-the-protected-routes\">\u0627\u06cc\u06a9 \u0645\u062d\u0641\u0648\u0638 \u0631\u0627\u0633\u062a\u06c1 \u0628\u0646\u0627\u0646\u0627<\/h2>\n<p>\u0627\u0628 \u0622\u0626\u06cc\u06d2 \u0627\u0646 \u0631\u0627\u0633\u062a\u0648\u06ba \u06a9\u0648 \u062c\u0648\u0691\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0648 \u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0628\u0646\u0627\u0646\u0627 <code>src\/routes\/content.js<\/code>:<\/p>\n<pre><code class=\"language-javascript\">const express = require('express');\nconst { verifyToken, checkRole } = require('..\/middleware\/auth');\n\nconst router = express.Router();\n\n\/\/ In-memory content store\nconst content = [\n  { id: '1', title: 'Getting Started with Node.js', author: 'admin' },\n  { id: '2', title: 'Express Middleware Explained', author: 'editor' },\n];\n\n\/\/ GET \/api\/content \u2014 all authenticated users\nrouter.get('\/', verifyToken, checkRole('user', 'editor', 'admin'), (req, res) => {\n  res.json({ content });\n});\n\n\/\/ POST \/api\/content \u2014 editors and admins only\nrouter.post('\/', verifyToken, checkRole('editor', 'admin'), (req, res) => {\n  const { title } = req.body;\n\n  if (!title) {\n    return res.status(400).json({ message: 'Title is required' });\n  }\n\n  const newItem = {\n    id: Date.now().toString(),\n    title,\n    author: req.user.email,\n  };\n\n  content.push(newItem);\n  res.status(201).json({ message: 'Content created', item: newItem });\n});\n\n\/\/ DELETE \/api\/content\/:id \u2014 admin only\nrouter.delete('\/:id', verifyToken, checkRole('admin'), (req, res) => {\n  const index = content.findIndex((c) => c.id === req.params.id);\n\n  if (index === -1) {\n    return res.status(404).json({ message: 'Content not found' });\n  }\n\n  content.splice(index, 1);\n  res.json({ message: 'Content deleted successfully' });\n});\n\nmodule.exports = router;\n<\/code><\/pre>\n<p>\u063a\u0648\u0631 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u06c1\u0631 \u0631\u0627\u0633\u062a\u06d2 \u06a9\u0648 \u067e\u0691\u06be\u0646\u0627 \u06a9\u062a\u0646\u0627 \u0622\u0633\u0627\u0646 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-javascript\">router.delete('\/:id', verifyToken, checkRole('admin'), handler)\n<\/code><\/pre>\n<p>\u0622\u067e \u06c1\u06cc\u0646\u0688\u0644\u0631 \u0628\u0627\u0688\u06cc \u06a9\u0648 \u067e\u0691\u06be\u06d2 \u0628\u063a\u06cc\u0631 \u0631\u0633\u0627\u0626\u06cc \u06a9\u0646\u0679\u0631\u0648\u0644 \u06a9\u0648 \u0633\u0645\u062c\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u067e\u0631 \u0645\u0628\u0646\u06cc RBAC \u06a9\u06d2 \u0627\u06c1\u0645 \u0641\u0648\u0627\u0626\u062f \u0645\u06cc\u06ba \u0633\u06d2 \u0627\u06cc\u06a9 \u06c1\u06d2\u06d4 \u0627\u062c\u0627\u0632\u062a\u06cc\u06ba \u06a9\u0627\u0631\u0648\u0628\u0627\u0631\u06cc \u0645\u0646\u0637\u0642 \u0645\u06cc\u06ba \u062f\u0641\u0646 \u06c1\u0648\u0646\u06d2 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 \u0631\u0648\u0679\u0646\u06af \u067e\u0631\u062a \u0645\u06cc\u06ba \u0645\u0648\u062c\u0648\u062f \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0628\u0646\u0627\u0646\u0627 <code>src\/routes\/admin.js<\/code>:<\/p>\n<pre><code class=\"language-javascript\">const express = require('express');\nconst { verifyToken, checkRole } = require('..\/middleware\/auth');\nconst { getAllUsers } = require('..\/data\/users');\n\nconst router = express.Router();\n\n\/\/ GET \/api\/admin\/users \u2014 admin only\nrouter.get('\/users', verifyToken, checkRole('admin'), (req, res) => {\n  res.json({ users: getAllUsers() });\n});\n\nmodule.exports = router;\n<\/code><\/pre>\n<h2 id=\"heading-putting-it-all-together\">\u06cc\u06c1 \u0633\u0628 \u0627\u06cc\u06a9 \u0633\u0627\u062a\u06be \u0688\u0627\u0644\u0646\u0627<\/h2>\n<p>\u0628\u0646\u0627\u0646\u0627 <code>src\/app.js<\/code>:<\/p>\n<pre><code class=\"language-javascript\">require('dotenv').config();\nconst express = require('express');\n\nconst authRoutes = require('.\/routes\/auth');\nconst contentRoutes = require('.\/routes\/content');\nconst adminRoutes = require('.\/routes\/admin');\n\nconst app = express();\n\napp.use(express.json());\n\n\/\/ Routes\napp.use('\/api\/auth', authRoutes);\napp.use('\/api\/content', contentRoutes);\napp.use('\/api\/admin', adminRoutes);\n\n\/\/ Health check\napp.get('\/', (req, res) => {\n  res.json({ message: 'RBAC API is running' });\n});\n\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, () => {\n  console.log(`Server running on port ${PORT}`);\n});\n<\/code><\/pre>\n<h2 id=\"heading-testing-the-api\">API \u0679\u06cc\u0633\u0679\u0646\u06af<\/h2>\n<p>\u0633\u0631\u0648\u0631 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba:<\/p>\n<pre><code class=\"language-bash\">npm run dev\n<\/code><\/pre>\n<h3 id=\"heading-step-1-register-users-with-different-roles\">\u0645\u0631\u062d\u0644\u06c1 1: \u0645\u062e\u062a\u0644\u0641 \u06a9\u0631\u062f\u0627\u0631\u0648\u06ba \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0648 \u0631\u062c\u0633\u0679\u0631 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u0631\u062c\u0633\u0679\u0631 \u0627\u06cc\u0688\u0645\u0646\u0633\u0679\u0631\u06cc\u0679\u0631:<\/p>\n<pre><code class=\"language-bash\">curl -X POST http:\/\/localhost:3000\/api\/auth\/register \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\": \"Admin User\", \"email\": \"admin@example.com\", \"password\": \"password123\", \"role\": \"admin\"}'\n<\/code><\/pre>\n<p>\u0628\u0637\u0648\u0631 \u0627\u06cc\u0688\u06cc\u0679\u0631 \u0631\u062c\u0633\u0679\u0631 \u06a9\u0631\u06cc\u06ba:<\/p>\n<pre><code class=\"language-bash\">curl -X POST http:\/\/localhost:3000\/api\/auth\/register \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\": \"Editor User\", \"email\": \"editor@example.com\", \"password\": \"password123\", \"role\": \"editor\"}'\n<\/code><\/pre>\n<p>\u0628\u0627\u0642\u0627\u0639\u062f\u06c1 \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0631\u062c\u0633\u0679\u0631 \u06c1\u0648\u06ba (\u06a9\u0648\u0626\u06cc \u06a9\u0631\u062f\u0627\u0631 \u062a\u0641\u0648\u06cc\u0636 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2 &#8211; \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0637\u06d2 \u0634\u062f\u06c1 \u06c1\u06d2\u06d4 <code>user<\/code>):<\/p>\n<pre><code class=\"language-bash\">curl -X POST http:\/\/localhost:3000\/api\/auth\/register \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"name\": \"Regular User\", \"email\": \"user@example.com\", \"password\": \"password123\"}'\n<\/code><\/pre>\n<h3 id=\"heading-step-2-log-in-and-get-a-token\">\u0645\u0631\u062d\u0644\u06c1 2: \u0644\u0627\u06af \u0627\u0646 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0679\u0648\u06a9\u0646 \u062d\u0627\u0635\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<pre><code class=\"language-bash\">curl -X POST http:\/\/localhost:3000\/api\/auth\/login \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"email\": \"user@example.com\", \"password\": \"password123\"}'\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u0648 \u062f\u0631\u062c \u0630\u06cc\u0644 \u062c\u0648\u0627\u0628 \u0645\u0644\u06d2 \u06af\u0627:<\/p>\n<pre><code class=\"language-json\">{\n  \"message\": \"Login successful\",\n  \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"\n}\n<\/code><\/pre>\n<p>\u0679\u0648\u06a9\u0646 \u06a9\u0627\u067e\u06cc \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-step-3-test-role-based-access\">\u0645\u0631\u062d\u0644\u06c1 3: \u0631\u0648\u0644 \u067e\u0631 \u0645\u0628\u0646\u06cc \u0631\u0633\u0627\u0626\u06cc \u06a9\u06cc \u062c\u0627\u0646\u0686 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p><strong>\u0645\u0648\u0627\u062f \u06a9\u0648 \u0627\u06cc\u06a9 \u0639\u0627\u0645 \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u067e\u0691\u06be\u06cc\u06ba (\u06a9\u0627\u0645\u06cc\u0627\u0628 \u06c1\u0648\u0646\u0627 \u0636\u0631\u0648\u0631\u06cc \u06c1\u06d2):<\/strong><\/p>\n<pre><code class=\"language-bash\">curl http:\/\/localhost:3000\/api\/content \\\n  -H \"Authorization: Bearer YOUR_TOKEN_HERE\"\n<\/code><\/pre>\n<p><strong>\u0627\u06cc\u06a9 \u0639\u0627\u0645 \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0645\u0648\u0627\u062f \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06cc \u06a9\u0648\u0634\u0634 \u06a9\u0631\u06cc\u06ba (\u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u0626\u06d2 &#8211; 403)\u06d4<\/strong><\/p>\n<pre><code class=\"language-bash\">curl -X POST http:\/\/localhost:3000\/api\/content \\\n  -H \"Authorization: Bearer YOUR_TOKEN_HERE\" \\\n  -H \"Content-Type: application\/json\" \\\n  -d '{\"title\": \"New Article\"}'\n<\/code><\/pre>\n<p>\u062c\u0648\u0627\u0628:<\/p>\n<pre><code class=\"language-json\">{\n  \"message\": \"Access denied. Required role: editor or admin. Your role: user\"\n}\n<\/code><\/pre>\n<p>\u0627\u0628 \u0627\u06cc\u0688\u06cc\u0679\u0631 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0644\u0627\u06af \u0627\u0646 \u06c1\u0648\u06ba \u0627\u0648\u0631 \u0627\u0633\u06cc POST \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0648 \u0622\u0632\u0645\u0627\u0626\u06cc\u06ba\u06d4 \u06a9\u0627\u0645\u06cc\u0627\u0628\u06cc \u0627\u06cc\u0688\u0645\u0646\u0633\u0679\u0631\u06cc\u0679\u0631 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0644\u0627\u06af \u0627\u0646 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 DELETE \u0631\u0648\u0679 \u06a9\u0648 \u0622\u0632\u0645\u0627\u0626\u06cc\u06ba\u06d4 \u0635\u0631\u0641 \u0627\u06cc\u0688\u0645\u0646 \u0679\u0648\u06a9\u0646 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-step-4-decode-the-jwt-to-see-the-role\">\u0645\u0631\u062d\u0644\u06c1 4: \u06a9\u0631\u062f\u0627\u0631 \u06a9\u0648 \u0686\u06cc\u06a9 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 JWT \u06a9\u0648 \u0688\u06cc \u06a9\u0648\u0688 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u0622\u067e \u067e\u06d2 \u0644\u0648\u0688 \u06a9\u0627 \u0645\u0639\u0627\u0626\u0646\u06c1 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0679\u0648\u06a9\u0646 jwt.io \u0645\u06cc\u06ba \u0686\u0633\u067e\u0627\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0622\u067e \u06a9\u0648 \u06a9\u0686\u06be \u0627\u0633 \u0637\u0631\u062d \u0646\u0638\u0631 \u0622\u0626\u06d2 \u06af\u0627:<\/p>\n<pre><code class=\"language-json\">{\n  \"id\": \"1720300000000\",\n  \"email\": \"admin@example.com\",\n  \"role\": \"admin\",\n  \"iat\": 1720300000,\n  \"exp\": 1720386400\n}\n<\/code><\/pre>\n<p>\u06a9\u06c1 <code>role<\/code> \u0648\u06c1 \u0645\u06cc\u062f\u0627\u0646 \u06c1\u06d2\u06d4 <code>checkRole<\/code> \u062a\u0645\u0627\u0645 \u0645\u062d\u0641\u0648\u0638 \u0634\u062f\u06c1 \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u06cc\u06ba \u067e\u0691\u06be\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-key-takeaways\">\u06a9\u0644\u06cc\u062f\u06cc \u0679\u06cc\u06a9 \u0648\u06cc\u0632<\/h2>\n<p>\u06a9\u0631\u062f\u0627\u0631 JWT \u067e\u06d2 \u0644\u0648\u0688 \u0645\u06cc\u06ba \u06c1\u06d2\u06d4 \u0631\u0648\u0644\u0632 \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0633\u0641\u0631 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0644\u06c1\u0630\u0627 \u062c\u0628 \u0628\u06be\u06cc \u06a9\u0648\u0626\u06cc \u0634\u062e\u0635 \u0645\u062d\u0641\u0648\u0638 \u0631\u0627\u0633\u062a\u06d2 \u0633\u06d2 \u0679\u06a9\u0631\u0627\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u0627\u0636\u0627\u0641\u06cc DB \u06a9\u0627\u0644\u0632 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u0644\u0627\u06af \u0627\u0646 \u06c1\u0648\u0646\u06d2 \u067e\u0631 \u0627\u0633\u06d2 \u0627\u0646\u062c\u06a9\u0634\u0646 \u0644\u06af\u0627\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0633\u0627\u062a\u06be \u062e\u0641\u06cc\u06c1 \u0637\u0648\u0631 \u067e\u0631 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u0642\u0627\u0628\u0644 \u062a\u0631\u062a\u06cc\u0628 \u06c1\u06d2\u06d4 <code>verifyToken<\/code> \u0627\u0648\u0631 <code>checkRole<\/code> \u06cc\u06c1 \u0627\u06cc\u06a9 \u0639\u0644\u06cc\u062d\u062f\u06c1\u060c \u062f\u0648\u0628\u0627\u0631\u06c1 \u0642\u0627\u0628\u0644 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0641\u0646\u06a9\u0634\u0646 \u06c1\u06d2\u06d4 \u0622\u067e \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0631\u0627\u0633\u062a\u06d2 \u0627\u0648\u0631 \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0627\u0645\u062a\u0632\u0627\u062c \u0633\u06d2 \u062c\u0691 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u062c\u0627\u0632\u062a\u06cc\u06ba \u0631\u0627\u0633\u062a\u06d2 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u0638\u0627\u06c1\u0631 \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 <code>router.delete('\/:id', verifyToken, checkRole('admin'), handler)<\/code> \u06c1\u06cc\u0646\u0688\u0644\u0631 \u06a9\u0648 \u067e\u0691\u06be\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06cc\u06c1 \u0622\u067e \u06a9\u0648 \u0631\u0633\u0627\u0626\u06cc \u06a9\u0646\u0679\u0631\u0648\u0644 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0633\u0628 \u06a9\u0686\u06be \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u0645\u06cc\u06ba \u0628\u06be\u06cc\u062c\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0627\u0646 \u0645\u06cc\u0645\u0648\u0631\u06cc \u0633\u0631\u0646\u06cc \u06a9\u0627 \u0645\u0642\u0635\u062f \u0627\u0633 \u0679\u06cc\u0648\u0679\u0648\u0631\u06cc\u0644 \u06a9\u0627 \u0645\u0631\u06a9\u0632 \u0631\u06c1\u0646\u0627 \u062a\u06be\u0627\u06d4 \u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u06a9\u06d2 \u0642\u0631\u06cc\u0628 \u067e\u06c1\u0646\u0686\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u0633\u06d2 \u062d\u0642\u06cc\u0642\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0633\u06d2 \u0628\u062f\u0644 \u062f\u06cc\u06ba\u06d4 \u0633\u0631\u0648\u0631 \u06a9\u0648 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u062a\u0645\u0627\u0645 \u0635\u0627\u0631\u0641\u06cc\u0646 \u0627\u0628\u06be\u06cc \u062d\u0630\u0641 \u06c1\u0648 \u062c\u0627\u0626\u06cc\u06ba \u06af\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>24 \u06af\u06be\u0646\u0679\u06d2 \u0679\u0648\u06a9\u0646 \u06a9\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06c1\u0648\u0646\u06d2 \u06a9\u06cc \u0645\u062f\u062a \u0628\u06c1\u062a \u0637\u0648\u06cc\u0644 \u06c1\u06d2\u06d4 \u0627\u0633\u06d2 15 \u0645\u0646\u0679 \u062a\u06a9 \u06a9\u0645 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0631\u06cc\u0641\u0631\u06cc\u0634 \u0679\u0648\u06a9\u0646 \u0631\u0648\u0679\u06cc\u0634\u0646 \u0634\u0627\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u0686\u0648\u0631\u06cc \u0634\u062f\u06c1 \u0679\u0648\u06a9\u0646 \u062a\u06cc\u0632\u06cc \u0633\u06d2 \u0628\u06cc\u06a9\u0627\u0631 \u06c1\u0648 \u062c\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p>\u062d\u0633\u0627\u0633 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc\u0648\u06ba \u06a9\u06d2 \u0644\u06cc\u06d2\u060c DB \u0645\u06cc\u06ba \u06a9\u0631\u062f\u0627\u0631\u0648\u06ba \u06a9\u06cc \u062f\u0648\u0628\u0627\u0631\u06c1 \u062a\u0648\u062b\u06cc\u0642 \u06a9\u0631\u06cc\u06ba\u06d4 \u0645\u0648\u062c\u0648\u062f\u06c1 \u0679\u0648\u06a9\u0646\u0632 \u0645\u06cc\u06ba \u0631\u0648\u0644 \u06a9\u06cc \u062a\u0628\u062f\u06cc\u0644\u06cc\u0627\u06ba \u0627\u0633 \u0648\u0642\u062a \u062a\u06a9 \u0638\u0627\u06c1\u0631 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u062a\u06cc \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u0627\u0646 \u06a9\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u0646\u06c1 \u06c1\u0648 \u062c\u0627\u0626\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>HTTPS\u060c \u06c1\u0645\u06cc\u0634\u06c1<\/p>\n<\/li>\n<li>\n<p>\u0627\u06af\u0631 \u0622\u067e \u06a9\u06cc \u0627\u062c\u0627\u0632\u062a \u06a9\u06cc \u0645\u0646\u0637\u0642 &quot;\u0631\u0648\u0644 \u0686\u06cc\u06a9\u0646\u06af&#8221; \u0633\u06d2 \u0622\u06af\u06d2 \u0628\u0691\u06be\u062a\u06cc \u06c1\u06d2\u060c \u062a\u0648 casl \u067e\u0631 \u0627\u06cc\u06a9 \u0646\u0638\u0631 \u0688\u0627\u0644\u06cc\u06ba\u06d4 \u0627\u0646\u062a\u0633\u0627\u0628 \u06a9\u06cc \u0633\u0637\u062d \u06a9\u06d2 \u0642\u0648\u0627\u0639\u062f \u06a9\u0648 \u0635\u0627\u0641 \u0637\u0648\u0631 \u067e\u0631 \u06c1\u06cc\u0646\u0688\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<\/ul>\n<h2 id=\"heading-conclusion\">\u0646\u062a\u06cc\u062c\u06c1<\/h2>\n<p>\u0627\u0633 \u06a9\u06d2 \u0645\u0631\u06a9\u0632 \u0645\u06cc\u06ba\u060c \u06cc\u06c1 \u062f\u0648 \u0645\u0688\u0644 \u0648\u06cc\u0626\u0631 \u0641\u0646\u06a9\u0634\u0646\u0632 \u0627\u0648\u0631 \u0627\u06cc\u06a9 JWT \u067e\u06d2 \u0644\u0648\u0688 \u0645\u06cc\u06ba \u0641\u0679 \u0628\u06cc\u0679\u06be\u062a\u0627 \u06c1\u06d2\u06d4 \u0645\u06cc\u06ba \u0646\u06d2 \u06a9\u0626\u06cc \u0645\u0646\u0635\u0648\u0628\u0648\u06ba \u0645\u06cc\u06ba \u0627\u0633\u06cc \u0637\u0631\u0632 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0627 \u06c1\u06d2\u06d4 \u0627\u0648\u0631 \u0627\u06cc\u06a9 \u0628\u0627\u0631 \u062c\u0628 \u0622\u067e \u0627\u0633\u06d2 \u062e\u0648\u062f \u0628\u0646\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u0622\u067e \u0627\u0633\u06d2 \u06c1\u0631 \u062c\u06af\u06c1 \u062a\u0644\u0627\u0634 \u06a9\u0631\u0646\u0627 \u0634\u0631\u0648\u0639 \u06a9\u0631 \u062f\u06cc\u06ba \u06af\u06d2\u060c \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u062a\u0642\u0631\u06cc\u0628\u0627\u064b \u06c1\u0631 \u0645\u0644\u0679\u06cc \u06cc\u0648\u0632\u0631 \u0627\u06cc\u067e \u06a9\u0648 \u0627\u06cc\u06a9 \u0645\u062e\u0635\u0648\u0635 \u0648\u0631\u0698\u0646 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><strong>GitHub \u067e\u0631 \u0645\u06a9\u0645\u0644 \u0633\u0648\u0631\u0633 \u06a9\u0648\u0688:<\/strong> github.com\/ziaongit\/nodejs-rbac-jwt-api<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u062c\u0628 \u0645\u06cc\u06ba \u0646\u06d2 \u0631\u0648\u0644\u0632 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0633\u0648\u0686\u06d2 \u0628\u063a\u06cc\u0631 \u0627\u067e\u0646\u0627 API \u0628\u0646\u0627\u06cc\u0627 \u062a\u0648 \u0645\u06cc\u06ba \u0646\u06d2 \u062a\u0645\u0627\u0645 \u0644\u0627\u06af \u0627\u0646 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0648 \u06cc\u06a9\u0633\u0627\u06ba \u0631\u0633\u0627\u0626\u06cc \u062f\u06cc\u06d4 \u0627\u0633 \u0646\u06d2 \u0627\u0633 \u0648\u0642\u062a \u062a\u06a9 \u0679\u06be\u06cc\u06a9 \u06a9\u0627\u0645 \u06a9\u06cc\u0627 \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u0627\u06cc\u06a9 \u0639\u0627\u0645 \u0635\u0627\u0631\u0641 \u063a\u0644\u0637\u06cc \u0633\u06d2 \u0688\u06cc\u0644\u06cc\u0679 \u0627\u06cc\u0646\u0688 \u067e\u0648\u0627\u0626\u0646\u0679 \u06a9\u0648 \u0646\u06c1\u06cc\u06ba \u0645\u0627\u0631\u062a\u0627 \u0627\u0648\u0631 \u0679\u06cc\u0633\u0679 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0645\u0679\u0627 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0648\u06c1 \u062f\u0646 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-26491","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/26491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/comments?post=26491"}],"version-history":[{"count":0,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/26491\/revisions"}],"wp:attachment":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/media?parent=26491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/categories?post=26491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/tags?post=26491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}