CRUD
Create, Read, Update, Delete.
These are the basic Data Access operations. In this project you will build a basic command line application (CLI) that allows you to take read and write notes directly from the command line into a .json file.
Along the way you'll learn about Model Objects and File IO (one of Node's 3 super-powers).
Index
Learning Objectives
- JSON
- Reading & Writing to files
- Model objects
- Closures
- CRUD operations
- CLI's
Specifications
For each basic model file in this demo app:
- Write the model object
- Test the model object in your /tests folder
For each model file with "json" in the name:
- Write the model object
- User Stories:
- Create
- Read
- Update
- Delete
- Initialize (creates .json file with empty DB object)
- Reset (clears nextID & data)
- Set name of DB
- See a helpful message or error after each operation
- User Stories:
- Test the model objecti in your /tests folder
- Write the model object
- Write a Node.js Handler & View.
- Build a repo for this project and include it on your portfolio.
Challenge:
- Allow a user to CRUD nested notes
Resources
File I/O in Node:
- Stackabuse
- Codementor
- node-jsonfile
- By Example - some of the apps have a db.txt, those use file io
- JSON format
- __dirname
Error Handling with Callbacks:
Blocking & Non-Blocking:
- Blocking vs Non-Blocking 1
- Blocking vs Non-Blocking 2
- Non-Blocking I/O 1
- Non-Blocking I/O 2
- How to know the difference?
NPM Installing:
Closures: