This project uses Quarkus, the Supersonic Subatomic Java Framework.
This project demonstrates the usage of MongoDB with Panache on top with reactive endpoints by creating entities and managing relations between and their corresponding operations in a blog crud like fashion.
This project is presented in the following article.
Creating a Reactive CRUD blog app with MongoDB, Quarkus and Panache
docker run -ti --rm -p 27017:27017 mongo:4.0
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
{
"id": "60dc9301971c0d514f62792e",
"author": "John Doe",
"comments": [
{
"id": "60dc930f971c0d514f62792f",
"content": "22323232",
"creationDate": "2021-06-30T17:51:43.781"
},
{
"id": "60dc9310971c0d514f627930",
"content": "22323232",
"creationDate": "2021-06-30T17:51:44.815"
},
{
"id": "60dc9311971c0d514f627931",
"content": "1337",
"creationDate": "2021-06-30T17:51:45.659"
}
],
"content": "This is some sample content",
"creationDate": "2021-06-30T17:51:29.812",
"title": "A new title"
}
$ curl "localhost:8080/posts"
$ curl "localhost:8080/posts/search?author=David&title=My Post"
$ curl "localhost:8080/posts/search?dateFrom=2021-06-17T00:00:00.000Z&dateTo=2022-06-17T00:00:00.000Z"
$ curl "localhost:8080/posts/search2?authors=John Doe&authors=Grace Kelly"
$ curl -X POST "localhost:8080/posts"
{
"title":"My Post",
"author":"John Doe"
}
$ curl -X PUT "localhost:8080/posts/60db336deb401c61ad7c559c"
{
"content":"This is a comment"
}
$ curl -X DELETE "localhost:8080/posts/60db4b085d2d613300cc136b"
$ curl GET "localhost:8080/comments"
$ curl -X PUT "localhost:8080/comments/60dc741f971c0d514f627904"
{
"content":"This is an update comment"
}
$ curl -X DELETE "localhost:8080/comments/60dc741f971c0d514f627904"