Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 3.57 KB

README.md

File metadata and controls

62 lines (42 loc) · 3.57 KB

Full Stack Open 2023 - Deep Dive Into Modern Web Development

Part 13 - Using relational databases

Node.js backend application using Express, Sequelize and PostgreSQL.

Setting up PostgreSQL with Docker

Pull Postgres image from Docker Hub and start a container in port 5432.

docker pull postgres

docker run -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres

Add database url as an environment variable.

DATABASE_URL='postgres://postgres:mysecretpassword@localhost:5432/postgres'

Access database via console

docker exec -it NAME-OF-THE-CONTAINER psql -U postgres postgres

Setting up the application

Install dependences and run the application

npm install 

npm start

Run Jest tests for APIs

npm test

Run commandline version (prints existing blogs from the database)

npm run cli

Exercises