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

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.

主站蜘蛛池模板: 会昌县| 卫辉市| 尉犁县| 西林县| 阳东县| 韶关市| 双峰县| 芦溪县| 延川县| 香港 | 湖州市| 绵阳市| 绥宁县| 高唐县| 杭锦旗| 南陵县| 新晃| 樟树市| 舟曲县| 揭东县| 上杭县| 搜索| 乐都县| 安化县| 商都县| 家居| 东安县| 泾源县| 特克斯县| 河池市| 迭部县| 海伦市| 广丰县| 阿克陶县| 淮滨县| 安多县| 同仁县| 岫岩| 宿迁市| 龙州县| 阿拉善右旗|