nbubna / store

A better way to use localStorage and sessionStorage
MIT License
1.91k stars 110 forks source link

Multiple users #126

Closed young-tea closed 3 weeks ago

young-tea commented 3 weeks ago

Hello, maybe I dont fully get the purpose of this thing, but I am building an app based on node js + express, and I need to store different arrays for different users, but what I am getting is that all the users share the same array

If it is not possible to do with this tool, I will be happy if someone could help me and say what I can try using (express session etc. will not work, and I need to store things in the local storage of users)

Thank you!

nbubna commented 3 weeks ago

To use this on the server (instead of in the browser), you would need a localStorage polyfill. It's aimed primarily at in-browser use. And so far as using it in-browser goes, unless your users share browsers, it is going to inherently be per-user by default. You could use namespaces for your users, though, if you wanted to support multiple users in the same browser.

So far as storing things on the server goes, i generally recommend a proper database.