官术网_书友最值得收藏!

Adding and saving notes

In the previous section, you learned how to work with JSON inside Node.js, and this is the exact format we'll be using for the notes.js application. When you first run a command, we'll load in all the notes that might already exist. Then we'll run the command, whether it's adding, removing, or reading notes. Finally, if we've updated the array, like we will when we add and remove notes, we'll save those new notes back into the JSON file.

Now, this will all happen inside of the addNote function, which we defined in the notes.js application, and we already wired up this function. In earlier sections, we ran the app add command, and this function executed with the title and body arguments.

主站蜘蛛池模板: 准格尔旗| 翼城县| 岢岚县| 龙泉市| 维西| 马关县| 哈密市| 大渡口区| 黑河市| 苍山县| 徐闻县| 晋江市| 鄯善县| 乌恰县| 大关县| 五大连池市| 西畴县| 合川市| 新乡市| 威远县| 德庆县| 金溪县| 乌拉特后旗| 毕节市| 雅江县| 台州市| 东乌珠穆沁旗| 广水市| 广昌县| 怀宁县| 通化市| 达尔| 昭苏县| 仲巴县| 于都县| 佳木斯市| 鄂托克前旗| 肥乡县| 民勤县| 丹寨县| 汉阴县|