Sample Helidon MP project that includes multiple REST operations. This project requires Oracle NoSQL for data storage, which can be run locally or online.
This application requires Oracle NoSQL Database, which can be set up to run locally using Docker.
To run Oracle NoSQL Database locally, use the following Docker command:
docker run -d --name oracle-instance -p 8080:8080 ghcr.io/oracle/nosql:latest-ce
This command starts an Oracle NoSQL instance running on port 8080
of your local machine.
Alternatively, you may run Oracle NoSQL Database online. For more details, refer to Oracle’s official documentation on running NoSQL in the cloud.
To build and run this project, use JDK 21.
mvn package
java -jar target/movies.jar
The application will start on localhost
at port 8181
.
To verify if the application is running, check its health status with:
curl -s -X GET http://localhost:8181/health
Expected Output:
{"outcome":"UP",…}
You can retrieve application metrics in Prometheus or JSON format.
curl -s -X GET http://localhost:8181/metrics
Expected Output:
# TYPE base:gc_g1_young_generation_count gauge…
This project includes an OpenAPI UI, which provides an interactive interface for exploring and testing API endpoints.
To access the OpenAPI UI, navigate to the following URL in your browser:
The OpenAPI UI displays all available API endpoints and allows you to test requests directly within the browser.
Below are examples of using curl
to interact with the API.
# Example: Fetch all movies
curl -X GET http://localhost:8181/movies
# Example: Add a new movie
curl -X POST -H "Content-Type: application/json" -d '{"title": "Inception", "genre": "SCIENCE_FICTION", "releaseYear": 2010, "director": "Christopher Nolan", "actors": ["Leonardo DiCaprio", "Joseph Gordon-Levitt"]}' http://localhost:8181/movies
# Example: Update a movie
curl -X PUT -H "Content-Type: application/json" -d '{"title": "Inception", "genre": "SCIENCE_FICTION", "releaseYear": 2010, "director": "Christopher Nolan", "actors": ["Leonardo DiCaprio", "Joseph Gordon-Levitt"]}' http://localhost:8181/movies/{id}
# Example: Delete a movie
curl -X DELETE http://localhost:8181/movies/{id}
If you don’t have access to a Kubernetes cluster, you can install one on your desktop.
kubectl cluster-info # Verify which cluster
kubectl get pods # Verify connectivity to cluster
kubectl create -f app.yaml # Deploy application
kubectl get pods # Wait for quickstart pod to be RUNNING
kubectl get service movies # Get service info
kubectl port-forward service/movies 8181:8080 # Forward service port to 8181
You can now exercise the application as described above but use port 8181
.
After you’re done, clean up:
kubectl delete -f app.yaml