This repo was initially created as practice for learning to Dockerise both a Hapi.js server & PostgreSQL database. The server was set up to allow for communication with the database and enable read/write functionality. Now this project is used for implementing different technologies and methods used at work.
- Docker & Docker Compose
- Node.js
- Hapi.js
- PostgreSQL (pgAdmin 4 for database management)
- Azure Service Bus
In-depth documentation has been completed in the form of a comprehensive write-up.
- Setting up a simple server using Hapi.js.
- Configuring a Dockerfile for a Node.js environment.
- Defining a Hapi.js server & PostgreSQL database using Docker Compose.
- Establishing a connection to a PostgreSQL database using the node-postgres NPM package.
- Saving messages sent through a node application to a Service Bus queue and topic.
- Saving messages sent via Service Bus queue to a postgres database.
- Run
docker compose up --build
. - Confirm the server is running on
localhost:3001
and the messageHello World!
is visible. Alternatively check Docker Desktop to ensure the container is running. - To ensure connection to the database is successful, navigate into the
app
directory and runnode database
. Note if an empty array is returned, the connection was successful, there is just no existing data to be returned. Use the queries to insert, update, and delete data. - Once set up locally,
docker compose down
anddocker compose up
can be used to stop and start the container respectively.