If you don't already, install Node and PostgreSQL on your computer.
Run the following command:
npm i
- Open psql shell, login as a user
- Create a new database in the psql shell.
CREATE DATABASE DBNAME;
- To connect to this database, run this in psql.
\c DBNAME
- Get a sample database from the
forum.sql
file (with the data) by the following command on bash:
psql -d DBNAME -U USERNAME -f forum.sql
Alternatively, to create an empty database, run SQL commands from the file create_tables.sql
. Do this in psql:
\i <absolute path of create_tables.sql in your PC>
- Check the database by running the following psql command
\d
- Change the value of the
connectionString
option inconfig/db.js
to connect to your local database.
postgres://USERNAME:PASSWORD@localhost:5432/DBNAME
- Run the app by the following command
npm start