This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
This Git organization is an example site for a Travel Company. I made this for study and fun, please feel free to watch or fork it!
You can run all microservice with a MySQL DB configured and initialized via sql script in Database project, or simply run with mocked in-memory data. Check the META-INF/microprofile-config.properties file
This part is related to the dynamic home page, here you can see the showcase and the offers about hotels
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
Frontend application exposed on localhost:8080/
Backend APIs:
- http://localhost:8080/home/showcase --> via HTTP GET
- http://localhost:8080/home/offers --> via HTTP GET
Build Front End part: inside folder /src/main/angular/home-ng
ng build
The application can be packaged using:
./mvnw package
It produces the home-quarkus-travel-1.0.0-SNAPSHOT-runner.jar
file in the /target
directory.
Be aware that it’s not an über-jar as the dependencies are copied into the target/lib
directory.
If you want to build an über-jar, execute the following command:
./mvnw package -Dquarkus.package.type=uber-jar
The application is now runnable using java -jar target/home-quarkus-travel-1.0.0-SNAPSHOT-runner.jar
.
You can create a native executable using:
./mvnw package -Pnative
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
./mvnw package -Pnative -Dquarkus.native.container-build=true
You can then execute your native executable with: ./target/home-quarkus-travel-1.0.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html.
In order to build the application on Openshift you can enable the property: quarkus.kubernetes.deploy=true
And run in a logged in shell:
./mvnw package
you can also pass the property directlly in the shell command:
./mvnw package -Dquarkus.kubernetes.deploy=true
Create a ConfigMap for declare the API Endpoints, the config should be like:
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: travelsite
data:
endpoint.home: "http://home.endpoint.example.com"
endpoint.hotel: "http://hotel.endpoint.example.com"
endpoint.login: "http://login.endpoint.example.com"
endpoint.registration: "http://registration.endpoint.example.com"
endpoint.usermanagement: "http://usermanagement.endpoint.example.com"
The main framework used is Quarkus by Red Hat, for the frontend part the framework used is Angular.
Before generate a full JAR, please build Angular part via (inside folder /src/main/angular/home-ng)
ng build
This will generate the frontend page in the Quarkus static files folder.
REST APIs creator and exposer
Guide: https://quarkus.io/guides/rest-json
Error management and resilient applications
Guide: https://quarkus.io/guides/microprofile-fault-tolerance
Database manager and injectable (used with MySQL in this project)
If you run in 'IN_MEMORY' mode, the datasource use will be skipped
Guide: https://quarkus.io/guides/datasource
Context Dependency and Injection, used to inject in the logic the Java beans
Guide: https://quarkus.io/guides/cdi
Read and inject properties and env variables configuration in your app
Guide: https://quarkus.io/guides/config
A simple REST exposer with application data, in order to check if application is up and running.
Check the localhost:8080/health if you running in dev mode
Guide: https://quarkus.io/guides/microprofile-health
Simple use JUnit for unit tests, the core is managed by Quarkus. Rest call managed by restassured