In this practice, you will test and debug an Express-Sequelize server using a Render.com PostgresQL database server.
This exercise will prepare you to debug and deploy your first project.
First, complete the following readings to understand the database architecture pattern you will be using, and learn how to setup a schema in an Express and Sequelize application. You will not need to set up the schema yourself in this exercise, but you will need to be familiar with the changes so that you can debug the server.
- Exploring Database Architecture Patterns
- Setting up a Schema in Express and Sequelize
Next, set up a Render.com PostgresQL database instance. This is the database that you will use in production for your practice application, and the database you will use during this practice. You will be connecting to this database locally through Sequelize and the PSQL shell.
- Setting up a Postgres Database Instance on Render.com
Finally, you will need to download the PSQL Command Line Tools, which will allow you to access and interact with your Render PostgresQL database from the terminal. Read the following article and complete the installation.
- Install PSQL Command Line Tools
-
Run the
1-setup-commands-basic.sh
script to install dependencies at the root and server directories. This will also migrate and seed your SQLite3 development database, located at server/db/dev.db. -
Examine the output in the console. If migration and seeding was successful, you should see the following at the bottom of the output:
----- Tables Have Data? -----
bandCount|5
instrumentCount|8
musicianCount|10
musicianInstrumentCount|16
- Run
npm test
to run all mocha tests. All 4 tests are expected to pass with the SQLite3 development database.
In the phases that follow, you will learn how to locally configure this server to use a PostgresQL database hosted on Render instead of SQLite3. The migration and seeding will fail due to a few common bugs related to differences between SQLite3 and PostgresQL.
You will need to debug the server code so that it works locally with the PostgresQL database server.
Phase 1: Configuring Node Environments Phase 2: Using PSQL Command Line Tools Phase 3: Debugging the Association Bonus Phase 4: Debugging Other Common Issues