Data storage and asynchronous code
It's worth discussing the concept of asynchronous code again, since external data storage systems, by definition, require asynchronous code. The access time to retrieve data from disk, from another process, or from a database always takes enough time to require deferred execution.
Accessing in-memory data takes a few clock cycles, making it possible to directly operate on in-memory data without delays that would prevent a Node.js server from handling events. Data stored anywhere else, even in the memory space of another process, requires a delay to access that data. This is long enough to prevent the Node.js server from handling events. The rule of thumb is that asynchronous coding is not required for data retrievable within microseconds. But when the time to retrieve the data takes longer, asynchronous coding is required. Since Node.js is a single-thread system, application code cannot block the event loop.
The existing Notes application used an in-memory...