2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

webアプリでデータをどこに保存するか

Posted at

データの保存場所に悩む

  • dbとapiサーバーを別に立てる
    • 一番確実だけど、一番手間がかかる。車輪の再発明もいいとこ
  • localstorageに保存する
    • 一番簡単だけど、何かの拍子で消えるのが怖い。
    • 大量のデータには向いてない。最初に全部読み込んで、保存時は全部書き込む くらいの勢いが必要
  • indexedDb
    • 手間は中くらい。ライブラリ使わず直で叩くのは、ギリ悩む程度には面倒くさい。
    • ブラウザだけで完結するのが強み。大量のデータもOK
    • 所詮chrome管理だから、何かの拍子で消えるリスクはある。
  • firebase
    • 手間はindexedDbと同じくらいかな
    • firebaseの管理も必要なのがめんどくさい
    • 消えるリスクは考えなくていい

chromeの中に保存する方法はhtmlファイルだけで完結するけど、chromeのキャッシュクリアとかその辺でデータが飛ぶリスク有り。OSがぶっ壊れてchromeのユーザプロファイルのデータから直にデータを抜くのは結構めんどい。

外部にデータを保存する方法は管理が面倒。個人利用ならfirebaseの無料プランで収まるだろうけど。firebaseがいくら高速としても、chromeの中で完結する方法にはかなわないから読み込み速度の問題もある。

nodejsの場合

  • sqlite
    • windowsだとsqliteモジュールのインストールに失敗する事があるのでトラウマ。
  • json
    • データをまるごとjsonに書き出すのが手っ取り早い

firebaseかな。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?