{"id":606,"date":"2020-03-22T18:30:35","date_gmt":"2020-03-22T09:30:35","guid":{"rendered":"https:\/\/www.typea.info\/blog\/?p=606"},"modified":"2020-03-22T18:36:02","modified_gmt":"2020-03-22T09:36:02","slug":"cloud_functions_for_firebase_dev_env","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2020\/03\/22\/cloud_functions_for_firebase_dev_env\/","title":{"rendered":"Cloud Functions for Firebase \u306e\u958b\u767a\u74b0\u5883\u3092\u3068\u3068\u306e\u3048\u308b"},"content":{"rendered":"<p><a href=\"https:\/\/www.amazon.co.jp\/Firebase%E3%81%AB%E3%82%88%E3%82%8B%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%83%AC%E3%82%B9%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%9A%E3%83%BC%E3%82%B8%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3-%E6%8A%80%E8%A1%93%E3%81%AE%E6%B3%89%E3%82%B7%E3%83%AA%E3%83%BC%E3%82%BA%EF%BC%88NextPublishing%EF%BC%89-%E5%B0%8F%E5%B3%B6-%E4%BD%91%E4%B8%80-ebook\/dp\/B07RWXSNRH\/ref=as_li_ss_il?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;dchild=1&amp;keywords=Firebase&amp;qid=1584869362&amp;sr=8-2&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=45af4a7e9a8ee2b82d9e1a139edefcbd\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=B07RWXSNRH&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" border=\"0\" \/><\/a><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=li2&amp;o=9&amp;a=B07RWXSNRH\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/><\/p>\n<p><a href=\"http:\/\/www.typea.info\/blog\/index.php\/2020\/03\/17\/google-cloud-functinos\/\">Cloud Functions \u6e96\u5099<\/a>\u3092\u884c\u3063\u305f\u306e\u3067\u3001FIrebase\u3068\u306e\u9023\u643a\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u74b0\u5883\u3092\u6574\u3048\u305f\u3044\u3002<\/p>\n<h2>1.Cloud Functions for Firebase<\/h2>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/functions?hl=ja\">https:\/\/firebase.google.com\/docs\/functions?hl=ja<\/a><\/p>\n<blockquote><p>Cloud Functions for Firebase \u3092\u4f7f\u7528\u3059\u308b\u3068\u3001Firebase \u6a5f\u80fd\u3084 HTTPS \u30ea\u30af\u30a8\u30b9\u30c8\u306b\u3088\u3063\u3066\u30c8\u30ea\u30ac\u30fc\u3055\u308c\u305f\u30a4\u30d9\u30f3\u30c8\u306b\u5fdc\u3058\u3066\u3001\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 \u30b3\u30fc\u30c9\u3092\u81ea\u52d5\u7684\u306b\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002\u30b3\u30fc\u30c9\u306f Google \u306e\u30af\u30e9\u30a6\u30c9\u306b\u4fdd\u5b58\u3055\u308c\u3001\u30de\u30cd\u30fc\u30b8\u30c9\u74b0\u5883\u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u72ec\u81ea\u306e\u30b5\u30fc\u30d0\u30fc\u3092\u7ba1\u7406\u304a\u3088\u3073\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p><\/blockquote>\n<h3>1.1 \u52d5\u753b\u3067\u624b\u53d6\u308a\u8db3\u53d6\u308a<\/h3>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/functions\/video-series?hl=ja\">https:\/\/firebase.google.com\/docs\/functions\/video-series?hl=ja<\/a><\/p>\n<h2>2.\u74b0\u5883\u306e\u69cb\u7bc9<\/h2>\n<h3>2.1 Firebase CLI \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>Firebase \u306e CLI\u30c4\u30fc\u30eb\u3092\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<pre class=\"prettyprint\">&gt; npm install -g firebase-tools\n&gt; firebase --version<\/pre>\n<h3>2.2 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u30ed\u30b0\u30a4\u30f3<\/h3>\n<p>\u30d6\u30e9\u30a6\u30b6\u304c\u7acb\u3061\u4e0a\u304c\u308a\u3001Google\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u306e\u30ed\u30b0\u30a4\u30f3\u3092\u6c42\u3081\u3089\u308c\u308b<\/p>\n<pre class=\"prettyprint\">&gt;firebase login\ni  Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https:\/\/policies.google.com\/privacy) and is not used to identify you.\n\n? Allow Firebase to collect CLI usage and error reporting information? Yes\ni  To change your data collection preference at any time, run `firebase logout` and log in again.\n\nVisit this URL on this device to log in:\nhttps:\/\/accounts.google.com\/o\/oauth2\/auth?client_id...\n\nWaiting for authentication...\n\n+  Success! Logged in as typea0930@gmail.com<\/pre>\n<h3>2.3 Firebase \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210<\/h3>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3061\u8fbc\u307f\u3001\u30a6\u30a3\u30b6\u30fc\u30c9\u306b\u5f93\u3046\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u306f\u3001Cloud Functions \u306e\u307f\u6709\u52b9\u306b\u3057\u3001<a href=\"http:\/\/www.typea.info\/blog\/index.php\/2018\/06\/14\/android_kotlin_firebase\/\">\u4ee5\u524d\u4f5c\u6210\u3057\u305f\u65e2\u5b58\u306eFirebase\u30d7\u30ed\u30b8\u30a7\u30af\u30c8<\/a>\u3092\u9078\u629e\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint\">&gt; firebase init<\/pre>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/03\/firebase_init2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"firebase_init2\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/03\/firebase_init2_thumb.png\" alt=\"firebase_init2\" width=\"737\" height=\"560\" border=\"0\" \/><\/a><\/p>\n<h3>2.4 Functinos\u306e\u6700\u65b0\u5316<\/h3>\n<pre class=\"prettyprint\">&gt; cd functions\n&gt; npm install firebase-admin@latest <a href=\"mailto:firebase-functions@latest\">firebase-functions@latest<\/a><\/pre>\n<pre class=\"prettyprint\"><\/pre>\n<h3>2.5 \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h3>\n<p>\u30b5\u30f3\u30d7\u30eb\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u30b3\u30e1\u30f3\u30c8\u30a4\u30f3\u3057\u3066\u305d\u306e\u307e\u307e\u4f7f\u3046\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/03\/firebase_function_src.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"firebase_function_src\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/03\/firebase_function_src_thumb.png\" alt=\"firebase_function_src\" width=\"750\" height=\"278\" border=\"0\" \/><\/a><\/p>\n<h3>2.6 \u30c7\u30d7\u30ed\u30a4<\/h3>\n<pre class=\"prettyprint\">&gt; firebase deploy --only functions<\/pre>\n<h4>2.6.1 \u30a8\u30e9\u30fc<\/h4>\n<p>\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u305f\u3081\u3001typescript \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<p>(tslint\u3082\u9069\u5b9c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb)<\/p>\n<blockquote><p>&#8216;tsc&#8217; \u306f\u3001\u5185\u90e8\u30b3\u30de\u30f3\u30c9\u307e\u305f\u306f\u5916\u90e8\u30b3\u30de\u30f3\u30c9\u3001 \u64cd\u4f5c\u53ef\u80fd\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u307e\u305f\u306f\u30d0\u30c3\u30c1 \u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u8a8d\u8b58\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/p><\/blockquote>\n<pre class=\"prettyprint\">\n&gt; npm install typescript \u2013g<\/pre>\n<h2>3.\u5b9f\u884c<\/h2>\n<p>OK!<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/03\/firebase_success.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"firebase_success\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/03\/firebase_success_thumb.png\" alt=\"firebase_success\" width=\"718\" height=\"251\" border=\"0\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cloud Functions \u6e96\u5099\u3092\u884c\u3063\u305f\u306e\u3067\u3001FIrebase\u3068\u306e\u9023\u643a\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u74b0\u5883\u3092\u6574\u3048\u305f\u3044\u3002 1.Cloud Functions for Firebase https:\/\/firebase.g [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[104,112,100],"tags":[],"class_list":["post-606","post","type-post","status-publish","format-standard","hentry","category-firebase","category-google-cloud-functions","category-google-cloud-platform"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=606"}],"version-history":[{"count":3,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/606\/revisions"}],"predecessor-version":[{"id":610,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/606\/revisions\/610"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}