Using an ORM package
The advantage of working directly with the database is that you have control over how every statement is written and executed. The drawback is that can be a complex and time-consuming process.
An alternative is to use an ORM package that deals with the database on behalf of the developer, hiding some aspects of SQL and taking care of mapping between the database and JavaScript objects.
The range of features provided by ORM packages varies widely. Some take a light-touch approach and focus on transforming data, but most packages deal with most aspects of using a database, including defining the SQL schema, creating the database, and even generating queries.
ORM packages can be great, but you still have to have a basic understanding of SQL, which is why I started this chapter with a direct-to-database example. ORM packages expect the developer to understand how their features will be used to create and use databases, and you won’t be able to...