java-endpoint / DemoApplication.java
KevanSoon
changed java file
514e1e9
raw
history blame
469 Bytes
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));
});
}
}