* [BAEL-1615] Code to support article. * Adding example of provides...with * Adding uses to main module * [BAEL-1659] Creat REST microservices with javalin * [BAEL-1659] Update article code based on feedback * Revert parent pom change * Using Optional instead of null
17 lines
462 B
Java
17 lines
462 B
Java
package com.baeldung.javalin;
|
|
|
|
import com.baeldung.javalin.User.UserController;
|
|
import io.javalin.Javalin;
|
|
|
|
public class JavalinApp {
|
|
public static void main(String[] args) {
|
|
Javalin app = Javalin.create()
|
|
.port(7000)
|
|
.start();
|
|
|
|
app.get("/hello", ctx -> ctx.html("Hello, Javalin!"));
|
|
app.get("/users", UserController.fetchAllUsernames);
|
|
app.get("/users/:id", UserController.fetchById);
|
|
}
|
|
}
|