8 Connecting Databases
I know that I know nothing.—Socrates
As you’ve already seen in the previous chapters, when you implement applications, you also need to store data all the time. Node.js only provides you with the fs module for persisting data. The drawback of storing data directly in the file system is that this method isn’t optimized for directly accessing specific information in large data sets. In the worst case, you’ll have to search an entire file for the information you need, which can be very time-consuming depending on the file size. This is one reason you should use databases to persist information in your application. They also offer additional features such as scalability or transaction security.
In most cases, databases aren’t ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access