Install Docker Desktop for Mac following the official guide.
Run the script to start the postgres container:
ca-animal-lovers/backend $ ./start-postgres.sh
To connect to the postgres container, fetch the container ID first:
➜ backend git:(ziniz/add-local-db) ✗ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fae215ff958c postgres:16.3 "docker-entrypoint.s…" 45 minutes ago Up 45 minutes (healthy) 0.0.0.0:5432->5432/tcp caal-postgres
Here fae215ff958c
is the container id.
Then open a shell for the postgres container:
$ docker exec -it fae215ff958c sh
In the shell, connect to psql db:
$ psql -U caal
And you are now conencted to the DB.
Install tsx
:
$ sudo npm install tsx -g
Create the dogs
table on in your local Postgres DB and populate the table with mock data:
$ DELETE_EXISTING_TABLE=true tsx backend/src/db/populateLocalDB.ts
To start the backend server, from the directory root run
$ npm run start:backend