LoginSignup
11
5

More than 5 years have passed since last update.

Firebaseすっごーい!(FirebaseによるWebサイトのホスティング)

Last updated at Posted at 2017-12-23

概要

やんごとなき理由がありhttpsのサイトが必要になったので、Firebaseを使ってみることに。
感動的に簡単に出来たのでqiitaに残す。マジ簡単だから使ってみてくれ。

準備

以下のものが必要だよ
* Googleのアカウント

なんとこれだけ!すっごーい!

Firebaseのプロジェクトを作る

以下のサイトでFirebaseのプロジェクトを作る
https://console.firebase.google.com/

Firebase CLI(firebase-tools)のセットアップ

CLI(firebase-tools)のインストール

npmパッケージになっている。
以下のコマンドを実行することでインストールできる。

npm install -g firebase-tools

firebaseにログイン

以下のコマンドを実行するとブラウザが立ち上がる。認証するとログインが完了する。

firebase login

プロジェクトの初期化

以下のコマンドでプロジェクトを初期化できる。

firebase init

CLIで色々聞かれるけど、今回はプロジェクトは上で作ったFirebaseプロジェクトを選択。
あと「hosting」を選択すればOK。

適当にやってればpublic/index.htmlができるはずだ。
あとは好きに編集してくれ。

デプロイ

以下のコマンドでデプロイができる。
たーのしー!

firebase deploy

以下がコンソールに出力される。

=== Deploying to 'hogehoge-project'...

i  deploying hosting
i  hosting: preparing public directory for upload...
✔  hosting: 1 files uploaded successfully

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/hogehoge-project/overview
Hosting URL: https://hogehoge-project.firebaseapp.com

Hosting URLにアクセスすれば作ったページが見れるよ。

料金

料金は以下を参照してくれ。
とくに遊びで使ってたら金なんかかからない。

つかってみた所感

すっごーい!
smile.jpg

11
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
5