「Gcp/Firebase/Hosting」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→Must select at least one feature. Use SPACEBAR to select features, or provide a feature with firebase init [feature_name]エラー) |
(→firebaseのfunctionsと連携) |
||
| 行33: | 行33: | ||
ttps://xxxx-xxxxxx.firebaseapp.com/helloWorld にアクセスすると、 | ttps://xxxx-xxxxxx.firebaseapp.com/helloWorld にアクセスすると、 | ||
functionsのhelloWorldメソッドにアクセスできる | functionsのhelloWorldメソッドにアクセスできる | ||
| + | |||
| + | ==ドメインつなぎ込み== | ||
| + | #firebase/hostingのドメインを接続 ボタンを押す | ||
| + | #設定したいdomain入力 | ||
| + | #以下のようなドメイン設定のためのTXTの値が出る | ||
| + | google-site-verification=12341234xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
| + | #TXTをドメインに登録する | ||
2019年6月11日 (火) 15:47時点における版
$ npm install -g firebase-tools $ firebase login $ firebase init $ firebase deploy
hostingを選択してspaceを押す
目次
Must select at least one feature. Use SPACEBAR to select features, or provide a feature with firebase init [feature_name]エラー
spaceを押して選択する
httpアクセス
ttps://xxxx-xxxxxx.firebaseapp.com/
public/index.html がそのまま公開される
firebaseのfunctionsと連携
vi firebase.json
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "/helloWorld", "function": "helloWorld"
} ]
}
}
ttps://xxxx-xxxxxx.firebaseapp.com/helloWorld にアクセスすると、 functionsのhelloWorldメソッドにアクセスできる
ドメインつなぎ込み
- firebase/hostingのドメインを接続 ボタンを押す
- 設定したいdomain入力
- 以下のようなドメイン設定のためのTXTの値が出る
google-site-verification=12341234xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- TXTをドメインに登録する
