D
D
Dvorak2016-06-24 19:10:03
JavaScript
Dvorak, 2016-06-24 19:10:03

Is it correct to store data on the server this way?

Hello.
I am writing a bot for Telegram. Bot users are stored as an object with three fields, one of which is an array. I simply store all users in an array and, if necessary, connect via require (). Is it correct? I just heard that it is usually customary to store either in JSON or in XML

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2016-06-24
@allishappy

ok, this is normal as long as you only use it, and storage involves something ... let's say non-volatile, such as writing to a database, or to a file, in short, to a durable medium that allows you to restore information after a reboot. To store records in a file / db, there are different types of serialization, such as json, serialize, and xml is more of a variant of structuring / meta description of information, although it can play the role of storage, it is neither the most convenient nor the fastest in processing , + is also rather redundant. In your case (because you use JS), JSON will be the normal form for serializing stored objects, but I would look towards the database and human storage.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question