Skip to content

cbdyzj/onion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Onion

Release

Usage

Onion<HttpServerExchange> onion = new Onion<>();

Onion.Middleware<HttpServerExchange> log = (ctx, nxt) -> {
    Stream.of("Before: ", ctx.getRequestPath(), "\n").forEach(System.out::print);
    nxt.next();
    Stream.of("After: ", ctx.getRequestPath(), "\n").forEach(System.out::print);
};

Onion.Middleware<HttpServerExchange> hi = (ctx, nxt) -> {
    System.out.println("Say Hi");
    ctx.getResponseSender().send("Hi");
    nxt.next();
};

onion.use(log).use(hi);

Undertow.builder()
        .setHandler(onion::handle)
        .addHttpListener(8000, "0.0.0.0")
        .build().start();

About

Onion is just like an Onion

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages