- Learning Node.js Development
- Andrew Mead
- 209字
- 2021-06-30 18:57:01
Running the getNote function
Now that we have this in place we can test out this brand new functionality inside of Terminal by running our app using node app.js. I'll use the read command, and I'll pass in a title equal to some string that I know does not exist inside of a title in the notes-data.json file:
node app.js read --title="something here"
When I run the command, we get Note not found, as shown here, and this is exactly what we want:

Now, if I do try to fetch a note where the title does exist, I would expect that note to come back.
In the data file I have a note with a title of to buy; let's try to fetch that one. I'll use the up arrow key to populate the previous command and replace the title with to space, buy, and hit enter:

As shown in the previous code, you can see Note found prints to the screen, which is fantastic. Following Note found we have our spacers and following that we have the title, which is to buy, and the body, which is food, exactly as it appears inside of the data file. With this in place, we are done with the read command.
- Modern JavaScript Web Development Cookbook
- 重新定義Spring Cloud實(shí)戰(zhàn)
- 網(wǎng)絡(luò)故障現(xiàn)場處理實(shí)踐(第4版)
- Proxmox High Availability
- HCNA網(wǎng)絡(luò)技術(shù)
- 物聯(lián)網(wǎng)通信技術(shù)
- Microservice Patterns and Best Practices
- 基于性能的保障理論與方法
- 沖擊:5G如何改變世界
- 物聯(lián)網(wǎng)
- 數(shù)字王國里的虛擬人:技術(shù)、商業(yè)與法律解讀
- 互聯(lián)網(wǎng)心理學(xué):新心理與行為研究的興起
- 云計(jì)算、網(wǎng)絡(luò)安全和網(wǎng)絡(luò)盜竊:網(wǎng)絡(luò)世界防盜初學(xué)指南
- Oracle ADF Faces Cookbook
- 計(jì)算機(jī)聯(lián)鎖及信號微機(jī)監(jiān)測系統(tǒng)