feat: add /health endpoint and Docker healthcheck
This commit is contained in:
@@ -14,6 +14,12 @@ services:
|
|||||||
- "8080"
|
- "8080"
|
||||||
volumes:
|
volumes:
|
||||||
- ${DATA_VOLUME:-data}:/data
|
- ${DATA_VOLUME:-data}:/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||||
|
interval: 10m
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
start_period: 15s
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
data:
|
data:
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ router.get("/", (ctx) => {
|
|||||||
ctx.response.body = "Hello world";
|
ctx.response.body = "Hello world";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get("/health", (ctx) => {
|
||||||
|
ctx.response.body = { status: "ok" };
|
||||||
|
});
|
||||||
|
|
||||||
router.get("/notes", (ctx) => {
|
router.get("/notes", (ctx) => {
|
||||||
const cursor = ctx.request.url.searchParams.get("cursor") ?? undefined;
|
const cursor = ctx.request.url.searchParams.get("cursor") ?? undefined;
|
||||||
const limit = Number(ctx.request.url.searchParams.get("limit")) || PAGINATION;
|
const limit = Number(ctx.request.url.searchParams.get("limit")) || PAGINATION;
|
||||||
|
|||||||
Reference in New Issue
Block a user