[Home](../README.md) | [History and Motivation](../01-history-and-motivation/README.md) | [Technology Overview](../02-technology-overview/README.md) | [Installation and Set Up](../03-installation-and-set-up/README.md) | [Using 3rd Party Containers](../04-using-3rd-party-containers/README.md) | [Example Web Application](../05-example-web-application/README.md) | [Building Container Images](../06-building-container-images/README.md) | [Container Registries](../07-container-registries/README.md) | [Running Containers](../08-running-containers/README.md) | [Container Security](../09-container-security/README.md) | [Interacting with Docker Objects](../10-interacting-with-docker-objects/README.md) | [Development Workflows](../11-development-workflow/README.md) | [Deploying Containers](../12-deploying-containers/README.md) --- # Sample web application ![](./readme-assets/app-screenshot.png) ## Minimal 3 tier web application - **React frontend:** Uses react query to load data from the two apis and display the result - **Node JS and Golang APIs:** Both have `/` and `/ping` endpoints. `/` queries the Database for the current time, and `/ping` returns `pong` - **Postgres Database:** An empty PostgreSQL database with no tables or data. Used to show how to set up connectivity. The API applications execute `SELECT NOW() as now;` to determine the current time to return. ![](./readme-assets/tech-stack.png) ## Running the Application While the whole point of this course is that you probably won't want/need to run the application locally (See: `11-development-workflow`), we can do so as a starting point. The `Makefile` contains the commands to start each application. ### Postgres It's way more convenient to run postgres in a container as we saw in `04-using-3rd-party-containers`, so we will do that. `make run-postgres` will start postgres in a container and publish port 5432 from the container to your localhost. ### api-node To run the node api you will need to run `npm install` to install the dependencies (I used node `v19.4.0` and npm `v9.2.0`). After installing the dependencies, `make run-api-node` will run the api in development mode with nodemon for restarting the app when you make source code changes. ### api-golang To run the golang api you will need to run `go mod download` to download and install the dependencies (I used `go1.19.1`) After installing the dependencies, `make run-api-golang` will build and run the api. ### client-react Like `api-node`, you will first need to install the dependencies with `npm install` (again, I used node `v19.4.0` and npm `v9.2.0`) After installing the dependencies, `make run-client-react` will use vite to run the react app in development mode.