From 4d0ae5286dedfa6acc61e676274a74e531c61486 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 14 Apr 2024 12:44:05 +0100 Subject: [PATCH] add health endpoint --- influx-commands.md | 7 ++++++ .../backend/controller/HealthController.java | 22 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 influx-commands.md create mode 100644 src/main/java/xyz/mcutils/backend/controller/HealthController.java diff --git a/influx-commands.md b/influx-commands.md new file mode 100644 index 0000000..36bb7f3 --- /dev/null +++ b/influx-commands.md @@ -0,0 +1,7 @@ +# Useful InfluxDB commands + +## Delete data from bucket + +```bash +influx delete --bucket mcutils --start 2024-01-01T00:00:00Z --stop 2025-01-05T00:00:00Z --org mcutils --token setme --predicate '_measurement="requests_per_route" +``` \ No newline at end of file diff --git a/src/main/java/xyz/mcutils/backend/controller/HealthController.java b/src/main/java/xyz/mcutils/backend/controller/HealthController.java new file mode 100644 index 0000000..cb14fbc --- /dev/null +++ b/src/main/java/xyz/mcutils/backend/controller/HealthController.java @@ -0,0 +1,22 @@ +package xyz.mcutils.backend.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import xyz.mcutils.backend.config.Config; + +import java.util.Map; + +@Controller +@RequestMapping(value = "/") +public class HealthController { + + @GetMapping(value = "/health") + public ResponseEntity home() { + return ResponseEntity.ok(Map.of( + "status", "OK" + )); + } +}