File size: 380 Bytes
366df66
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class DemoApplication {

    public static void main(String[] args) {
        // Hugging Face provides the port via environment variable
        int port = Integer.parseInt(System.getenv().getOrDefault("PORT", "8080"));

        Javalin app = Javalin.create().start(port);

        app.get("/user", ctx -> {
            ctx.json(new User("Kevan", 21));
        });
    }
}