JavaScript Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

31st Dec 2021, 10:01 AM
Lidya Reine
Lidya Reine - avatar
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
31st Dec 2021, 9:46 PM
VCoder
VCoder - avatar
+ 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
1st Jan 2022, 6:17 AM
Arnav Kumar [Less/Not Active]
Arnav Kumar [Less/Not Active] - avatar