概要
野球アプリを作っていく上でのバックエンドプラットフォームをFirebaseにしていきたい。
公式ドキュメント
Hostingのサービスを作って公開してみる
Firebase Hostingは静的、動的コンテンツを配信できる。
- SSL通信機能
- 各国のCDNから配信
- デプロイが簡単
チュートリアルを利用してつかってみる
Firebase CLIをインストール
[local-mac vue-baseball]
$ npm install -g firebase-tools
/Users/yackman/.nvm/versions/node/v11.4.0/bin/firebase -> /Users/yackman/.nvm/versions/node/v11.4.0/lib/node_modules/firebase-tools/lib/bin/firebase.js
> @google-cloud/functions-emulator@1.0.0-beta.5 postinstall /Users/yackman/.nvm/versions/node/v11.4.0/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator
> node scripts/upgrade-warning
If you're using the Emulator via the Firebase CLI, you can
disregard this message.
If you're upgrading @google-cloud/functions-emulator, these
are the recommended upgrade steps:
1. Stop the currently running emulator, if any:
functions stop
2. Uninstall the current emulator, if any:
npm uninstall -g @google-cloud/functions-emulator
3. Install the new version of the emulator:
npm install -g @google-cloud/functions-emulator
If you have trouble after upgrading, try deleting the config
directory found in:
~/.config/configstore/@google-cloud/functions-emulator
Then restart the emulator. You can also check for any renegade
Node.js emulator processes that may need to be killed:
ps aux | grep node
+ firebase-tools@6.3.1
added 544 packages from 272 contributors in 29.354s
[local-mac vue-baseball]
firebase init
[local-mac vue-baseball]
$ firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
/Users/hoge/dev/vue-baseball
? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confirm your choices. Hosting: Configure and deploy Firebase Hosting sites
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Select a default Firebase project for this directory: [create a new project]
=== Hosting Setup
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
? What do you want to use as your public directory? public
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
✔ Wrote public/index.html
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
i Writing gitignore file to .gitignore...
✔ Firebase initialization complete!
Project creation is only available from the Firebase Console
Please visit https://console.firebase.google.com to create a new project, then run firebase use --add
[local-mac vue-baseball]