Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
"Is there any best practice that prefers databases over files" ?
> all of them
> why would you store datas in files???
Only "env" file should contain important datas, but these datas are precisely there for a website's secret key or some key for google maps
If anyone has access to your server by a way or another and reaches your files, you can kiss them goodbye
devNaut1723ySome private and public keys and some spare configuration info are more suitable for plain files ..but user credentials, token, sessions, i'm not sure......
- More efficient because you don't have to open a file every time
- Easier to handle (edit and add datasets)
- In some cases more secure because they need passwords
And I'm sure there are many more reasons to use databases I can't think of right now. The only con is that they are harder to setup and require some knowledge.
It really depends on the app. Sometimes I use files as a quick and dirty database, either by json or just serialized data. If I care about data resilience, and tracking changes, with multiple requests using the same data, I'll use a proper database.
stop59403y- serverbased databases : multiple client or concurrent connections
- sqlite : local stuff, multiple rows persistent format, binary data
- files : all other