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

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.

主站蜘蛛池模板: 奉节县| 平定县| 昭觉县| 治多县| 阿瓦提县| 勐海县| 特克斯县| 长丰县| 宁南县| 库伦旗| 新和县| 湄潭县| 菏泽市| 陵水| 饶阳县| 阿克陶县| 惠安县| 长武县| 库车县| 黄龙县| 白山市| 海南省| 咸丰县| 上犹县| 和田县| 哈密市| 盘山县| 宜城市| 龙口市| 天门市| 柘城县| 泰州市| 金坛市| 乌拉特前旗| 卢氏县| 临湘市| 靖边县| 镇宁| 华蓥市| 若尔盖县| 聊城市|