Simple sample app that uses a REST API for storing and retrieving values written in Golang.
This application exposes the following HTTP-based APIs:
-
Description: Saves/updates the given user’s name and date of birth in the database.
Request: PUT /hello/<username> { “dateOfBirth”: “YYYY-MM-DD” } Response: 204 No Content
Note: must contain only letters. YYYY-MM-DD must be a date before the today date. -
Description: Returns hello birthday message for the given user
Request: Get /hello/<username> Response: 200 OK
Response Examples:
A. If username’s birthday is in N days:
{ “message”: “Hello, <username>! Your birthday is in N day(s)”}
Response Examples:
B. If username’s birthday is today:
{ “message”: “Hello, <username>! Happy birthday!” }
This simple application is written in Go and expects a MySQL database for storing data.
After cloning this repository, if you want to run it locally you can do it in two ways:
- Through podman-compose:
$ podman-compose up -d
For this you would need to build it locally by running either docker build -t jrosental/devops-test .
or podman build -t jrosental/devops-test
.
Also bear in mind that in the docker-compose.yaml file you would need to adjust the environment variable DBHOST
to point to your local machine IP address.
- Standalone by building the image locally and passing the address of another database instance through the
DBHOST
environment variable
- DBHOST in the format
<IP-address>:<port>
, e.g: 127.0.0.1:3306 - DBUSER which is the user for connect to the database.
- DBPASS which is the password for the user to connect to the database.