You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jooby comes with couple of options for getting started: manual, maven archetype and command line tool.
4
-
5
-
=== Java
6
-
7
-
1) Add the dependency:
8
-
9
-
[dependency, artifactId="jooby-netty"]
10
-
.
11
-
12
-
[TIP]
13
-
====
14
-
Jooby is a multi-server web framework. You are free to choose between: Jetty, Netty and Undertow.
15
-
====
16
-
17
-
2) Write code:
18
-
19
-
.App.java:
20
-
[source, java]
21
-
----
22
-
import io.jooby.Jooby;
23
-
24
-
public class App extends Jooby {
25
-
26
-
{
27
-
get("/", ctx -> "Hello World!");
28
-
}
29
-
30
-
public static void main(String[] args) {
31
-
runApp(args, App::new);
32
-
}
33
-
}
34
-
----
35
-
36
-
=== Kotlin
37
-
38
-
1) Add Kotlin dependencies:
39
-
40
-
[dependency, artifactId="kotlin-stdlib-jdk8, kotlin-reflect:Optional. Only for MVC routes, kotlinx-coroutines-core:Optional. Only for suspend handlers"]
41
-
.
42
-
43
-
2) Write code:
44
-
45
-
.App.kt
46
-
[source, kotlin]
47
-
----
48
-
import io.jooby.runApp
49
-
50
-
fun main(args: Array<String>) {
51
-
runApp(args) {
52
-
53
-
get("/") { ctx -> "Hello World!" }
54
-
55
-
}
56
-
}
57
-
----
58
-
59
-
Run `App`:
60
-
61
-
----
62
-
INFO App started with:
63
-
INFO PID: 21661
64
-
INFO port: 8080
65
-
INFO server: netty
66
-
INFO routes:
67
-
68
-
GET /
69
-
70
-
listening on:
71
-
http://localhost:8080/
72
-
73
-
----
74
-
75
-
Ready {love}!
76
-
77
-
=== Maven Archetype
78
-
79
-
The Maven archetype creates a minimal Jooby application.
0 commit comments