https://github.com/ucl/covid-api-helidon
https://github.com/ucl/covid-api-helidon
eclipselink helidon helidon-mp java jersey microprofile persistence rest
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ucl/covid-api-helidon
- Owner: UCL
- Created: 2022-08-02T09:18:13.000Z (over 2 years ago)
- Default Branch: devel
- Last Pushed: 2022-09-12T23:14:50.000Z (over 2 years ago)
- Last Synced: 2024-12-06T20:41:57.444Z (5 months ago)
- Topics: eclipselink, helidon, helidon-mp, java, jersey, microprofile, persistence, rest
- Language: Java
- Homepage:
- Size: 127 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# covid-api-helidon
COVID Dashboard API Component

## Build and run
With JDK17+
```bash
mvn package
java -jar target/covid-api-helidon.jar
```## Exercise the application
```
curl -X GET http://localhost:8080/simple-greet
{"message":"Hello World!"}
``````
curl -X GET http://localhost:8080/greet
{"message":"Hello World!"}curl -X GET http://localhost:8080/greet/Joe
{"message":"Hello Joe!"}curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http://localhost:8080/greet/greeting
curl -X GET http://localhost:8080/greet/Jose
{"message":"Hola Jose!"}
```## Try metrics
```
# Prometheus Format
curl -s -X GET http://localhost:8080/metrics
# TYPE base:gc_g1_young_generation_count gauge
. . .# JSON Format
curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics
{"base":...
. . .
```## Try health
```
curl -s -X GET http://localhost:8080/health
{"outcome":"UP",...```
## Building a Native Image
Make sure you have GraalVM locally installed:
```
$GRAALVM_HOME/bin/native-image --version
```Build the native image using the native image profile:
```
mvn package -Pnative-image
```This uses the helidon-maven-plugin to perform the native compilation using your installed copy of GraalVM. It might take a while to complete.
Once it completes start the application using the native executable (no JVM!):```
./target/covid-api-helidon
```Yep, it starts fast. You can exercise the application’s endpoints as before.
## Build the Docker Image
```
docker build -t covid-api-helidon .
```
## Building a Custom Runtime Image
Build the custom runtime image using the jlink image profile:
```
mvn package -Pjlink-image
```This uses the helidon-maven-plugin to perform the custom image generation.
After the build completes it will report some statistics about the build including the reduction in image size.The target/covid-api-helidon-jri directory is a self contained custom image of your application. It contains your application,
its runtime dependencies and the JDK modules it depends on. You can start your application using the provide start script:```
./target/covid-api-helidon-jri/bin/start
```Class Data Sharing (CDS) Archive
Also included in the custom image is a Class Data Sharing (CDS) archive that improves your application’s startup
performance and in-memory footprint. You can learn more about Class Data Sharing in the JDK documentation.The CDS archive increases your image size to get these performance optimizations. It can be of significant size (tens of MB).
The size of the CDS archive is reported at the end of the build output.If you’d rather have a smaller image size (with a slightly increased startup time) you can skip the creation of the CDS
archive by executing your build like this:```
mvn package -Pjlink-image -Djlink.image.addClassDataSharingArchive=false
```For more information on available configuration options see the helidon-maven-plugin documentation.
## Reporting bugs
Please use the Github issue tracker for any bugs or feature suggestions:
[https://github.com/UCL/covid-api-helidon/issues](https://github.com/UCL/covid-api-helidon/issues)
## Authors
- David Guzman (Github: [@david-guzman](https://github.com/david-guzman))