Repository containing all the source code for Yakshop, the Tundra's first home-grown webshop for all your yak produce.
- Docker
- Maven3
- java 11 (jre/jdk)
- A local copy of this repository
http -> git clone https://github.com/xebia/yakshop-iggydv.git
ssh -> git clone git@github.com:xebia/yakshop-iggydv.git
This application is a spring-boot application built in Java 11, using maven as dependency and package manager. This application is intended to be executed as a JAR.
In order to build the application the following commands can be used:
mvn clean package
This will download and build all the required project dependencies and package it as a JAR file.
In order to run all groovy and junit + webmvc tests, the following commands can be used:
mvn verify
To run the application, simply use following command:
java -jar target\yakshop-0.0.1-SNAPSHOT.jar
The application can also be executed as a docker container.
In order to build the docker image, the JAR needs to exist first.
To ensure the image can be built, the following commands can be used:
mvn clean package
docker build . -t yakshop
To run the application using docker, the following can be used:
docker run -p 8080:8080 -t yakshop
If you are unable to build the application locally, the docker image can be pulled directly from dockerhub.
docker pull iggydv12/yakshop
to run the container-image use
docker run -p 8080:8080 -t iggydv12/yakshop
Once the application is up and running, the swagger API can be visited at http://localhost:8080/swagger-ui/index.html#/
The purpose of the application is to allow a heard of LabYaks to be loaded into the application via HTTP POST. Once the herd is loaded it can be queried and orders can be placed against the available stock.
Alternatively API endpoints can be accessed using curl commands.
Load new herd:
curl -X 'POST' \
'http://localhost:8080/yak-shop/load' \
-H 'accept: */*' \
-H 'Content-Type: application/xml' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<herd>
<labyak name="Betty-1" age="4" sex="f"/>
<labyak name="Betty-2" age="8" sex="f"/>
<labyak name="Betty-3" age="9.5" sex="f"/>
</herd>'