add healthcheck for kontor-javalin

This commit is contained in:
2025-12-21 21:15:08 +01:00
parent 3c4e182832
commit 11b13e0bf4
3 changed files with 16 additions and 1 deletions
@@ -2,6 +2,9 @@ package de.thpeetz.kontor.api;
import de.thpeetz.kontor.services.inmemory.InMemoryPersonReader;
import io.javalin.Javalin;
import java.util.HashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -19,6 +22,11 @@ public class Main {
var app = Javalin.create().start(port);
app.get("/ping", ctx -> ctx.result("pong"));
app.get("/health", ctx -> {
HashMap<String, String> status = new HashMap<>();
status.put("status", "ok");
ctx.json(status);
});
app.get("/persons", ctx -> {
logger.info("persons called");
ctx.json(result);