Spaces:
Sleeping
Sleeping
| 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)); | |
| }); | |
| } | |
| } | |