Good day, comrades! Help is needed! I started working on a single project in Node JS, and based on the MVC principle, I want to first create a database from scratch, without any third-party modules, programs, frameworks, etc. Help, how and where to start. But I know one that JSON is needed for this.
Thanks in advance!
- What is the database for? - vp_arth
|
1 answer
The most banal is
var mydbdb = {} //ΠΏΠΎΡΠΎΠΌ ΠΏΠΈΡΠ°ΡΡ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΡ Π½Π° Π΄ΠΈΡΠΊ fs.writeFileSync("./mydbdb.json", JSON.stringify(weights_JSON), 'utf8'); //ΠΈ ΠΏΡΠΈ Π·Π°ΠΏΡΡΠΊΠ΅ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ ΡΡΠΈΡΡΠ²Π°ΡΡ ΡΠ°ΠΊ var mydbdb = JSON.parse(fs.readFileSync("./mydbdb.json")); The only thing that does not always work correctly with some objects, for example RegEx will be recorded as [Object]
If there is a ready-made wrapper of this type in the form of NeDB .
|