forked from jooby-project/jooby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloApp.java
More file actions
41 lines (32 loc) · 820 Bytes
/
Copy pathHelloApp.java
File metadata and controls
41 lines (32 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package examples;
import io.jooby.Jooby;
import io.jooby.RouterOption;
import io.jooby.TraceHandler;
import io.jooby.banner.BannerModule;
public class HelloApp extends Jooby {
{
install(new BannerModule());
decorator(new TraceHandler());
setRouterOptions(RouterOption.IGNORE_TRAILING_SLASH);
get("/", ctx -> {
return "Hello World";
});
get("/foo/bar", ctx -> {
return ctx.getRequestPath() + "oo";
});
get("/foo/bar/", ctx -> {
return ctx.getRequestPath() + "oo/";
});
get("/foo/{bar}", ctx -> {
return ctx.path("bar").value();
});
}
public static void main(String[] args) {
runApp(args, HelloApp::new);
}
}