- Learning Node.js Development
- Andrew Mead
- 202字
- 2021-06-30 18:57:00
Summary
In this chapter, you learned that parsing in process.argv can be a real pain. We would have to write a lot of manual code to parse out those hyphens, the equal signs, and the optional quotes. However, yargs can do all of that for us and it puts it on a really simple object we can access. You also learned how to work with JSON inside Node.js.
Next, we filled out the addNote function. We're able to add notes using the command line, and we're able to save those notes into a JSON file. Finally, we pulled out a lot of the code from addNote into separate functions, fetchNotes and saveNotes, which are now separate, and they're able to be reused throughout the code. When we start filling out the other methods, we can simply call fetchNotes and saveNotes instead of having to copy the contents over and over again to every new method.
In the next chapter, we'll continue our journey on node fundamentals. We'll explore some more concepts related to node, such as debugging; we'll work on the read and remove notes commands. Apart from this, we'll also learn about the advanced features of yargs and the arrow function.
- Building E-commerce Sites with VirtueMart Cookbook
- C++黑客編程揭秘與防范
- 網(wǎng)管員典藏書架:網(wǎng)絡(luò)管理與運(yùn)維實(shí)戰(zhàn)寶典
- 光網(wǎng)絡(luò)評(píng)估及案例分析
- 物聯(lián)網(wǎng)安全與深度學(xué)習(xí)技術(shù)
- Web Application Development with R Using Shiny
- Metasploit Penetration Testing Cookbook
- Spring 5.0 Projects
- WordPress Web Application Development
- Learning Storm
- 5G+區(qū)塊鏈
- 深入理解Nginx:模塊開發(fā)與架構(gòu)解析
- INSTANT LinkedIn Customization How-to
- React Design Patterns and Best Practices(Second Edition)
- 走近2050:注意力、互聯(lián)網(wǎng)與人工智能