Skip to content

Handlers-http provides a minimal and adaptable interface for developing web applications on the vert-x3 platform.

License

Notifications You must be signed in to change notification settings

spriet2000/vertx-handlers-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vert.x handlers-http

Handlers-http provides a minimal and adaptable interface for developing web applications on the vert-x3 platform.

Handlers-http is an open webframework for the vert-x3 platform. The middleware layer doesn't depend on any custom classes, so components should be easily inter-changeable with different webframeworks.

Inspired by 'Build You Own Web Framework In Go'

Build Status

Setup server request handlers

    
ServerRequestHandlers<Void> handlers = use(
        new ExceptionHandler<>(),
        new ResponseTimeHandler<>(),
        new TimeoutHandler<>(vertx),
        (f, n) -> (req, arg) -> {
            req.response().end("hello world!");
            n.accept(req, arg);
        });

var handler = handlers.apply(
        (e, a) -> logger.error(a),
        (e, a) -> logger.info(a));

server.requestHandler(req -> handler.accept(req, null))
        .listen();

Implement server request handlers

public class HandlerImpl implements BiFunction<BiConsumer<HttpServerRequest, Throwable>,
        BiConsumer<HttpServerRequest, Void>, BiConsumer<HttpServerRequest, Void>> {

    @Override
    public BiConsumer<HttpServerRequest, Void> apply(
        BiConsumer<HttpServerRequest, Throwable> fail, BiConsumer<HttpServerRequest, Void> next) {
            return next;
    }
}

Remarks

  • Implementing handler still is quite verbose.

Example

https://github.com/spriet2000/vertx-handlers-http-example

Installation

<dependency>
    <groupId>com.github.spriet2000</groupId>
    <artifactId>vertx-handlers-http</artifactId>
    <version>0.1.0-SNAPSHOT</version>
</dependency>

About

Handlers-http provides a minimal and adaptable interface for developing web applications on the vert-x3 platform.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages