Payara with NoSQL
The NoSQL DB is a database that provides a mechanism for storage and retrieval of data, which is modeled by means other than the tabular relations used in relational databases. These databases have speed and high scalability. This kind of database is becoming more popular in several applications, which include financial ones. As a result of the increase, the number of users and vendors is increasing too. In the Jakarta EE world, there is the Jakarta NoSQL.
We'll create a similar rest application, but using MongoDB instead of relational database.
Using Docker
- Install docker: https://www.docker.com/
- https://store.docker.com/images/mongo
- Run docker command
- Run MongoDB: verify MongoDB image name with the command
docker images
, it can be mongodb or mongo, and then execute this commanddocker run -d --name mongodb-instance -p 27017:27017 mongo
How to Execute
mvn clean package payara-micro:bundle
java -jar -Xmx512m target/microprofile-microbundle.jar
Execute
curl --location --request POST 'http://localhost:8080/fishes' \
--header 'Content-Type: application/json' \
--header 'Content-Type: application/javascript' \
--data-raw '{"name": "payara"}'
curl --location --request GET 'http://localhost:8080/fishes'