8

Interacting with PostgreSQL Using Libraries

In the previous chapter, we established a foundation for persistent storage by setting up PostgreSQL within Docker, enabling us to perform basic SQL queries. This setup is crucial for storing data persistently across server sessions, directly impacting our application’s reliability and functionality.

Now, we’ll take a step forward by integrating SQL operations into our server. This chapter will focus on utilizing the pg library to interact with our PostgreSQL database from within our server code. You’ll learn how to seamlessly connect your backend server with the database, perform data operations, and ensure that your data handling is both efficient and secure.

The following is what we’ll cover in ...

Get Full-Stack Web Development with TypeScript 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.