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

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.

主站蜘蛛池模板: 舒兰市| 浮山县| 依安县| 微博| 钟山县| 巩留县| 木里| 新建县| 惠州市| 西城区| 江安县| 广东省| 大名县| 刚察县| 绥阳县| 吉水县| 波密县| 土默特右旗| 广灵县| 周口市| 东乡族自治县| 麟游县| 道真| 佛坪县| 克拉玛依市| 涡阳县| 德清县| 巴东县| 台江县| 彝良县| 夏邑县| 方正县| 遂昌县| 东乌| 台湾省| 博罗县| 武清区| 张掖市| 磐安县| 赤城县| 湘潭市|