Gcp/Firebase/Hosting
提供: 初心者エンジニアの簡易メモ
$ 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をドメインに登録する
- 設定後firebaseのドメイン接続で確認ボタンを押す
- 確認が取れたら、Aレコードが2つ表示されるので、それを再度登録。
