add healthcheck for kontor-javalin
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user