Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src/main Applied suggested fixes Dec 14, 2018
README.md
pom.xml

README.md

Vertx Web Api Service Example

This example shows you a complete working application with vertx-web-api-service & vertx-web-api-contract.

You have three packages:

  • models: Contains all models of your application. They are annotated as @DataObject so you can use it in other Vert.x interfaces.
  • persistence: Contains the interfaces and implementations of persistence of your application.
  • services: Contains the Web Api Services interfaces and implementations

The class WebApiServiceExampleMainVerticle contains the code that bootstrap your router using OpenAPI3RouterFactory and mounts your services on event bus with ServiceBinder.

You can find the OpenAPI spec under resources/openapi.json

Run

On this directory run:

mvn clean package
java -jar target/web-api-service-example-3.6.0-fat.jar

Then post a transaction with curl:

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"id": "xdg-hjhj98", "from":"thomas@example.com","to":"francesco@example.com", "message": "items", "value": 45.67}' \
  http://localhost:8080/api/transactions


curl http://localhost:8080/api/transactions

Eventually check the recorded transactions:

curl http://localhost:8080/api/transactions
You can’t perform that action at this time.