File size: 469 Bytes
514e1e9
 
366df66
514e1e9
366df66
514e1e9
366df66
 
514e1e9
 
 
 
366df66
514e1e9
 
366df66
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import io.javalin.Javalin;
import com.google.gson.Gson;

public class DemoApplication {
    public static void main(String[] args) {
        int port = 8080;
        Javalin app = Javalin.create().start(port);

        Gson gson = new Gson();

        app.get("/", ctx -> ctx.result("Hello from Javalin on Hugging Face!"));

        app.get("/user", ctx -> {
            User user = new User("Kevan", 21);
            ctx.result(gson.toJson(user));
        });
    }
}