/quarkus-rest-example

Example for a simple rest api with h2 datasource build on quarkus

Primary LanguageJavaApache License 2.0Apache-2.0

Quarkus Autonomous REST Example and Exception generator

This example shows a simple REST-API with intern H2 Database access running with Quarkus.

Technologies

  • Quarkus
  • Hibernate
  • H2 Database

Build

Run ./mvnw clean package or mvnw.cmd clean package (Windows) to build this project.

Run

java -jar target/quarkus-rest-example-1.0-runner.jar

REST call examples

Warning: It will add un-expected errors, just expect a binary consistency.

Get all contacts

curl -X GET http://localhost:8080/api/contacts

Get single contact

curl -X GET http://localhost:8080/api/contacts/-1

Add contact

curl -X POST -H "Content-Type: application/json" -d '{"companyName":"J+J Doe Inc.","firstName":"Jane","lastName":"Doe"}' http://localhost:8080/api/contacts

Update contact

curl -X PUT -H "Content-Type: application/json" -d '{"companyName":"J+J Doe Inc.","firstName":"Jane Q.","lastName":"Doe"}' http://localhost:8080/api/contacts/1

Delete contact

curl -X DELETE http://localhost:8080/api/contacts/-1