{"id":991,"date":"2024-11-18T15:46:47","date_gmt":"2024-11-18T15:46:47","guid":{"rendered":"https:\/\/varnagame.site\/?p=991"},"modified":"2026-02-25T09:05:21","modified_gmt":"2026-02-25T09:05:21","slug":"firebase-functions","status":"publish","type":"post","link":"https:\/\/varnagame.site\/?p=991","title":{"rendered":"Firebase Functions"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u0411\u0435\u0441\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 <\/h3>\n\n\n\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 JavaScript \u0438\u043b\u0438 TypeScript \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 Firebase \u0438\u043b\u0438 HTTPS-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u042d\u0442\u0430 \u0431\u0435\u0441\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0439\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n\n\n\n<p>\u042d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u0440\u043e\u0439\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a&nbsp;<a href=\"https:\/\/firebase.google.com\/docs\/functions\/get-started\" target=\"_blank\" rel=\"noreferrer noopener\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Firebase<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435-\u043f\u0440\u043e\u0435\u043a\u0442\u0430-firebase\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Firebase<a href=\"https:\/\/grammy.dev\/ru\/hosting\/firebase#%D1%81%D0%BE%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D0%B5-%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B0-firebase\">\u200b<\/a><\/h3>\n\n\n\n<ol>\n<li>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c&nbsp;<a href=\"https:\/\/console.firebase.google.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Firebase<\/a>&nbsp;\u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435&nbsp;<strong>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442<\/strong>.<\/li>\n\n\n\n<li>\u0415\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0438 \u043f\u0440\u0438\u043c\u0438\u0442\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f Firebase.<\/li>\n\n\n\n<li>\u041d\u0430\u0436\u043c\u0438\u0442\u0435&nbsp;<strong>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c<\/strong>.<\/li>\n\n\n\n<li>\u0420\u0435\u0448\u0438\u0442\u0435, \u0445\u043e\u0442\u0438\u0442\u0435 \u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0439 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/li>\n\n\n\n<li>\u041d\u0430\u0436\u043c\u0438\u0442\u0435&nbsp;<strong>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442<\/strong>.<\/li>\n\n\n\n<li>\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u0435 <strong>Functions<\/strong> (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043f\u043b\u0430\u043d)<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Firebase \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Firebase<\/h3>\n\n\n\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Functions \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 macOC.<\/p>\n\n\n\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0445 \u0432 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Firebase Functions, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0440\u0435\u0434\u0443 Node.js \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Firebase CLI (\u042d\u0442\u043e\u00a0\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 Firebase \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430).<\/p>\n\n\n\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c Firebase CLI   \u0431\u0443\u0434\u0435\u043c \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>mkdir my-frb-project<\/code><\/pre><\/div>\n\n\n\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 :<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>cd \/Users\/\u0425\u0425\u0425\u0425\u0425\u0425\u0425\u0425\/my-frb-project<\/code><\/pre><\/div>\n\n\n\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b package.json :<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npm init -y<\/code><\/pre><\/div>\n\n\n\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c  Firebase CLI. \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0430\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u0430\u043f\u043a\u0430 &#8220;node_modules&#8221;: <\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npm i firebase-tools -D<\/code><\/pre><\/div>\n\n\n\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e Firebase CLI :<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npx firebase-tools --version<\/code><\/pre><\/div>\n\n\n\n<p>\u041b\u043e\u0433\u0438\u043d\u0438\u043c\u0441\u044f \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443 firebase :  (\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u0441\u044f npx firebase-tools logout)<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npx firebase-tools login  <\/code><\/pre><\/div>\n\n\n\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c Firebase CLI   \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438  \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 firebase. \u041f\u0440\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0435&nbsp;&#8220;<strong>Do you want to use ESLint to catch probable bugs and enforce style?<\/strong>&#8221; \u041d\u0423\u0416\u041d\u041e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c &#8220;<strong>\u041d\u0415\u0422<\/strong>&#8221; \u0438\u0437-\u0437\u0430 &#8220;<strong>ESLint<\/strong>&#8221;&nbsp; \u043a\u0440\u0430\u0448\u0438\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u0444\u0430\u0440\u0431\u0435\u0439\u0437<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npx firebase init functions<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 VSCode \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/h2>\n\n\n\n<p>\u0412 vs-code \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <strong>\u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/strong> (\u043d\u0435 \u0444\u0430\u0439\u043b \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0430\u043f\u043a\u0443). \u041d\u0430\u0448 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 index.ts.  (\u0438\u043b\u0438  index.js  \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 js \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438).<br>\u0412\u043c\u0435\u0441\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b vs-code.<\/p>\n\n\n\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 &#8220;functions&#8221;<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>cd \/Users\/\u0425\u0425\u0425\u0425\u0425\u0425\u0425\u0425\/my-frb-project\/functions<\/code><\/pre><\/div>\n\n\n\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 index.ts  (\u0438\u043b\u0438  index.js  \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 js ) \u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448 \u043a\u043e\u0434.<\/p>\n\n\n\n<p>\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435  \u043f\u0438\u0448\u0435\u043c <strong>\u0444\u0443\u043d\u043a\u0446\u0438\u0438 Firebase (JavaScript)<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>IP-\u0430\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/strong> (Unity-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b), \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e HTTP-\u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>const functions = require(&quot;firebase-functions&quot;);\n\n\/\/ \u041f\u0440\u043e\u0441\u0442\u0430\u044f HTTP-\u0444\u0443\u043d\u043a\u0446\u0438\u044f\nexports.getClientIp = functions.https.onRequest((req, res) =&gt; {\n  \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441 \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0438\u043b\u0438 \u0441\u043e\u043a\u0435\u0442\u0430\n  const ip = req.headers[&#39;x-forwarded-for&#39;]?.split(&#39;,&#39;)[0] || req.connection.remoteAddress;\n\n  console.log(&quot;Client IP:&quot;, ip);\n\n  res.status(200).json({ ip });\n});\n<\/code><\/pre><\/div>\n\n\n\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430, \u0447\u0442\u043e\u0431 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Firebase Emulator Suite \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438\u0437 Firebase CLI <br><\/p>\n\n\n\n<p><strong>\u0422\u043e\u043b\u044c\u043a\u043e<\/strong> <strong>E\u0441\u043b\u0438 \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043d\u0430 TS<\/strong>:  \u0447\u0442\u043e\u0431 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443  \u043d\u0443\u0436\u043d\u043e \u0432 \u0444\u0430\u0439\u043b <strong>functions\/package.json<\/strong>   \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  &quot;name&quot;: &quot;functions&quot;,\n  &quot;description&quot;: &quot;Cloud Functions for Firebase&quot;,\n  &quot;scripts&quot;: {\n    &quot;lint&quot;: &quot;eslint --ext .js,.ts .&quot;,                      \/\/ \u043d\u043e\u0432\u043e\u0435\n    &quot;build&quot;: &quot;tsc&quot;,                                        \/\/ \u043d\u043e\u0432\u043e\u0435\n    &quot;build:watch&quot;: &quot;tsc --watch&quot;,                          \/\/ \u043d\u043e\u0432\u043e\u0435 \n    &quot;serve&quot;: &quot;firebase emulators:start --only functions&quot;,\n    &quot;shell&quot;: &quot;firebase functions:shell&quot;,\n    &quot;start&quot;: &quot;npm run shell&quot;,\n    &quot;deploy&quot;: &quot;firebase deploy --only functions&quot;,\n    &quot;logs&quot;: &quot;firebase functions:log&quot;\n  },\n  &quot;engines&quot;: {\n    &quot;node&quot;: &quot;22&quot;\n  },\n  &quot;main&quot;: &quot;index.js&quot;,\n  &quot;dependencies&quot;: {\n    &quot;firebase-admin&quot;: &quot;^12.6.0&quot;,\n    &quot;firebase-functions&quot;: &quot;^6.0.1&quot;\n  },\n  &quot;devDependencies&quot;: {\n    &quot;firebase-functions-test&quot;: &quot;^3.1.0&quot;\n  },\n  &quot;private&quot;: true\n}<\/code><\/pre><\/div>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442  \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440   \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npm run build:watch<\/code><\/pre><\/div>\n\n\n\n<p><strong>E\u0441\u043b\u0438 \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u043d\u0430 JS<\/strong>:  \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0443\u043d\u043a\u0442  (\u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 ) \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c<\/p>\n\n\n\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043e\u043a\u043d\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npm run serve<\/code><\/pre><\/div>\n\n\n\n<p>\u042d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0438 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 url \u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f\u00a0 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>**********-macbook functions % npm run serve\n\n&gt; serve\n&gt; firebase emulators:start --only functions\n\ni  emulators: Starting emulators: functions\n\u26a0  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: apphosting, auth, firestore, database, hosting, pubsub, storage, dataconnect\ni  functions: Watching &quot;**********\/functions&quot; for Cloud Functions...\n\u26a0  functions: Your requested &quot;node&quot; version &quot;22&quot; doesn&#39;t match your global version &quot;20&quot;. Using node@20 from host.\nServing at port 8390\n\n\u2714  functions: Loaded functions definitions from source: getClientIp.\n\u2714  functions[us-central1-getClientIp]: http function initialized (http:\/\/127.0.0.1:5001\/**********\/us-central1\/getClientIp).\n\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 \u2714  All emulators ready! It is now safe to connect your app. \u2502\n\u2502 i  View Emulator UI at http:\/\/127.0.0.1:4000\/               \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Emulator  \u2502 Host:Port      \u2502 View in Emulator UI             \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 Functions \u2502 127.0.0.1:5001 \u2502 http:\/\/127.0.0.1:4000\/functions \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n  Emulator Hub host: 127.0.0.1 port: 4400\n  Other reserved ports: 4500\n\nIssues? Report them at https:\/\/github.com\/firebase\/firebase-tools\/issues and attach the *-debug.log files.\n \ni  functions: Beginning execution of &quot;us-central1-getClientIp&quot;\n&gt;  Client IP: undefined\ni  functions: Finished &quot;us-central1-getClientIp&quot; in 8.162809ms<\/code><\/pre><\/div>\n\n\n\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0430\u0434\u0440\u0435\u0441\u00a0 http:\/\/127.0.0.1:5001\/**\/us-central1\/getClientIp\u00a0 \u0438 \u0432\u0438\u0434\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n\n\n\n<p>\u0417\u0430\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430  \u0441\u0430\u0440\u0432\u0435\u0440:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>npm run deploy<\/code><\/pre><\/div>\n\n\n\n<p><strong>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/strong>:<\/p>\n\n\n\n<p><a href=\"https:\/\/grammy.dev\/ru\/hosting\/firebase\">https:\/\/grammy.dev\/ru\/hosting\/firebase<\/a><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Getting started with Cloud Functions\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/2u6Zb36OQjM?start=140&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u0411\u0435\u0441\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 JavaScript \u0438\u043b\u0438 TypeScript \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10,20],"tags":[],"_links":{"self":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts\/991"}],"collection":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=991"}],"version-history":[{"count":19,"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts\/991\/revisions"}],"predecessor-version":[{"id":1121,"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts\/991\/revisions\/1121"}],"wp:attachment":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}