Skip to content

Simple utilities to remove some of the boilerplate code revolving around building vertx.io REST services.

License

Notifications You must be signed in to change notification settings

javadevmtl/vertx-web-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vertx-web-util

Simple utilities to remove some of the boilerplate code revolving around building vertx.io REST services.

Easy to use

It's the same vertx API with 1 additional factory method and a couple annotations. Fully transparent, it's just abstracting away most of the boilerplate code required to setup the HttpServer and wire the REST routes.

AbstractRestVerticle is a wrapper around AbstractVerticle, in fact you still get access to all the available properties and methods of AbstractVerticle

Annotations are similar to JAX-RS.

@Path("/api")
public class TestRestVerticle extends AbstractRestVerticle {

	public void start(Future<Void> startFuture) {
		httpOptions.setPort(8080);

		buildEndpoint(build -> {
			if(build.succeeded()) {
				startFuture.complete();
			} else {
				startFuture.fail(build.cause());
			}
		});
	}
	
	@GET("/handleget")
	public void handleGet(RoutingContext rc) {
		rc.response().end("handleGet() called.");
	}

	@POST(value = "/handlepost/", body = true)
	public void handlePost(RoutingContext rc) {
		rc.response().end(rc.getBodyAsJson().encodePrettily());
	}
}

About

Simple utilities to remove some of the boilerplate code revolving around building vertx.io REST services.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages