Skip to content

Practice repo used to Dockerise a simple Hapi.js server and a PostgreSQL database, and to play about with Azure.

Notifications You must be signed in to change notification settings

rtasalem/hapi-pg-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hapi.js + PostgreSQL + Docker

Background

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.

Libraries & Technologies

Documentation

In-depth documentation has been completed in the form of a comprehensive write-up.

Learning Milestones

  • 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.

Getting Started

  • Run docker compose up --build.
  • Confirm the server is running on localhost:3001 and the message Hello 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 run node 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 and docker compose up can be used to stop and start the container respectively.

About

Practice repo used to Dockerise a simple Hapi.js server and a PostgreSQL database, and to play about with Azure.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published