+ 1
JavaScript Question
Can JavaScript Be Used For Database Application?,Because I Want To Make Multiplayer Game With JavaScript,And If Cannot,Is There Some JavaScript Library That Can Make Database Application?
2 Answers
+ 1
Hello, you have 2 aproaches to use databases in JS :
1_Store the informations in a server :
You have to use Node.js, Express.js and Mongoose DB
2_Store the informations in the clients :
The fastest way as there no need of installation as they are Web APIs and also that these infos may be used offline, for that you may use :
LocalStorage to store a small amount of infos permanantly (5 Mb)
SessionStorage to store a small amount of infos until the tab is closed (5 Mb)
IndexedDB to store large amount of infos permanantly, use it only when necessary
I recommend you using the first method for multiplayer games and the second for solo games
+ 2
you can use Firebase's Real-time Database or Firestore
they are available on both server and client
and in client you can use Indexdb if you don't want external db
its just provides more storage than localstorage
localstorage is just for strings although you can convert objects to json string