「Gcp/Firebase/Hosting」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→Must select at least one feature. Use SPACEBAR to select features, or provide a feature with firebase init [feature_name]エラー) |
|||
| 行8: | 行8: | ||
==Must select at least one feature. Use SPACEBAR to select features, or provide a feature with firebase init [feature_name]エラー== | ==Must select at least one feature. Use SPACEBAR to select features, or provide a feature with firebase init [feature_name]エラー== | ||
spaceを押して選択する | spaceを押して選択する | ||
| + | |||
| + | ==httpアクセス== | ||
| + | ttps://xxxx-xxxxxx.firebaseapp.com/ | ||
| + | |||
| + | public/index.html がそのまま公開される | ||
| + | |||
| + | ==firebaseのfunctionsと連携== | ||
| + | vi firebase.json | ||
| + | <pre> | ||
| + | { | ||
| + | "hosting": { | ||
| + | "public": "public", | ||
| + | "ignore": [ | ||
| + | "firebase.json", | ||
| + | "**/.*", | ||
| + | "**/node_modules/**" | ||
| + | ], | ||
| + | "rewrites": [ { | ||
| + | "source": "/helloWorld", "function": "helloWorld" | ||
| + | } ] | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | ttps://xxxx-xxxxxx.firebaseapp.com/helloWorld にアクセスすると、 | ||
| + | functionsのhelloWorldメソッドにアクセスできる | ||
2019年6月11日 (火) 15:34時点における版
$ 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メソッドにアクセスできる
