Skip to content

Commit 04ece11

Browse files
authored
Add example-robaho project (#108)
1 parent d25a6ce commit 04ece11

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

examples/example-robaho/pom.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>io.avaje</groupId>
8+
<artifactId>examples</artifactId>
9+
<version>0.1</version>
10+
</parent>
11+
12+
<artifactId>example-robaho</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>io.github.robaho</groupId>
17+
<artifactId>httpserver</artifactId>
18+
<version>1.0.10</version>
19+
</dependency>
20+
21+
<dependency>
22+
<groupId>io.avaje</groupId>
23+
<artifactId>avaje-jex</artifactId>
24+
<version>3.0-RC4</version>
25+
</dependency>
26+
27+
<dependency>
28+
<groupId>org.slf4j</groupId>
29+
<artifactId>slf4j-jdk-platform-logging</artifactId>
30+
<version>2.0.16</version>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>ch.qos.logback</groupId>
35+
<artifactId>logback-classic</artifactId>
36+
<version>1.5.12</version>
37+
</dependency>
38+
39+
</dependencies>
40+
</project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.avaje;
2+
3+
import io.avaje.jex.Jex;
4+
5+
public class Main {
6+
7+
public static void main(String[] args) {
8+
9+
// Below system property is NOT required as it will register via service loading
10+
// System.setProperty("com.sun.net.httpserver.HttpServerProvider", "robaho.net.httpserver.DefaultHttpServerProvider");
11+
12+
Jex.create()
13+
.routing(routing -> routing
14+
.get("/", ctx -> ctx.text("root"))
15+
.get("/one", ctx -> ctx.text("one"))
16+
.get("/two/{name}", ctx -> {
17+
ctx.text("two Yo " + ctx.pathParam("name"));
18+
})
19+
.post("one", ctx -> ctx.text("posted")))
20+
.port(7002)
21+
.start();
22+
23+
}
24+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<configuration>
2+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
3+
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
4+
<level>TRACE</level>
5+
</filter>
6+
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
7+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
8+
</encoder>
9+
</appender>
10+
11+
<root level="INFO">
12+
<appender-ref ref="STDOUT"/>
13+
</root>
14+
15+
<logger name="io.avaje.jex" level="TRACE"/>
16+
<logger name="io.avaje.http.client" level="TRACE"/>
17+
18+
</configuration>

examples/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<modules>
1616
<module>example-jdk</module>
17+
<module>example-robaho</module>
1718
</modules>
1819

1920
<profiles>

0 commit comments

Comments
 (0)