diff --git a/examples/example-robaho/pom.xml b/examples/example-robaho/pom.xml new file mode 100644 index 00000000..972683fe --- /dev/null +++ b/examples/example-robaho/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + io.avaje + examples + 0.1 + + + example-robaho + + + + io.github.robaho + httpserver + 1.0.10 + + + + io.avaje + avaje-jex + 3.0-RC4 + + + + org.slf4j + slf4j-jdk-platform-logging + 2.0.16 + + + + ch.qos.logback + logback-classic + 1.5.12 + + + + diff --git a/examples/example-robaho/src/main/java/io/avaje/Main.java b/examples/example-robaho/src/main/java/io/avaje/Main.java new file mode 100644 index 00000000..d7366d27 --- /dev/null +++ b/examples/example-robaho/src/main/java/io/avaje/Main.java @@ -0,0 +1,24 @@ +package io.avaje; + +import io.avaje.jex.Jex; + +public class Main { + + public static void main(String[] args) { + + // Below system property is NOT required as it will register via service loading + // System.setProperty("com.sun.net.httpserver.HttpServerProvider", "robaho.net.httpserver.DefaultHttpServerProvider"); + + Jex.create() + .routing(routing -> routing + .get("/", ctx -> ctx.text("root")) + .get("/one", ctx -> ctx.text("one")) + .get("/two/{name}", ctx -> { + ctx.text("two Yo " + ctx.pathParam("name")); + }) + .post("one", ctx -> ctx.text("posted"))) + .port(7002) + .start(); + + } +} diff --git a/examples/example-robaho/src/main/resources/logback.xml b/examples/example-robaho/src/main/resources/logback.xml new file mode 100644 index 00000000..4bcf2f92 --- /dev/null +++ b/examples/example-robaho/src/main/resources/logback.xml @@ -0,0 +1,18 @@ + + + + TRACE + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + diff --git a/examples/pom.xml b/examples/pom.xml index 010bc923..a98476dc 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -14,6 +14,7 @@ example-jdk + example-robaho