Database Applications with JavaScript


This course takes the lessons of LS180 and introduces the concept of working with databases from your applications. We'll build a simple command-line application, then move on to a more advanced database-backed Todo application that uses a high-level relational abstraction library. We'll also talk about how to manage security, optimize SQL queries, and how to deploy your applications.

We'll continue to use Node.js, Express.js, and Pug throughout this course, but will also introduce the node-postgres package for working with databases. We'll also expose you to working with the asynchronous features of JavaScript.


Programming and Back-end Development

Detailed Syllabus


  • The node-postgres Package
  • async/await
  • Executing SQL Statements from JavaScript

Interacting with a Database in Code

  • Database Design
  • Listing Expenses
  • Displaying Help
  • Adding Expenses
  • Error Handling
  • Handling Parameters Safely
  • Code Structure
  • Searching Expenses
  • Deleting Expenses
  • Clearing Expenses
  • Counting and Totaling Expenses
  • Creating the Schema Automatically

Database-backed Web Applications

  • Session Persistence
  • Creating the Session Persistence Module
  • Display the List of Todo Lists
  • Loading and Sorting Todo Lists
  • Working With Todos
  • Working With Todo Lists
  • Working With Databases
  • Accessing the Database
  • Executing and Logging Database Queries
  • Loading Data From the Database
  • Refactoring the try/catch Blocks
  • Updating the Database
  • Drop-In Replacement

Multiple Users and Other Topics

  • Signing In and Out
  • Restricting Actions to Signed-in Users
  • Storing User Accounts in an External File
  • Personal Todo Lists
  • A Note about Security
  • Optimization Assignment
  • Configuring an Application for Deployment
  • Creating a Heroku Application
  • Deploying PG Applications to Heroku