From 33d8122f413827cac0c3f5de792ad82cba7b21f7 Mon Sep 17 00:00:00 2001 From: wenxing wang Date: Thu, 9 Jan 2025 09:11:31 +0000 Subject: [PATCH] fix: add health check endpoint --- .github/workflows/release-update.yml | 4 ++-- merkle-tree/src/routes/node.routes.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-update.yml b/.github/workflows/release-update.yml index 6584190..47235c2 100644 --- a/.github/workflows/release-update.yml +++ b/.github/workflows/release-update.yml @@ -3,7 +3,7 @@ name: Release updated on: push: branches: - - swati/updateImages + - wenxing/updateImages jobs: BuildDockerImage: @@ -37,7 +37,7 @@ jobs: build-args: | GPR_TOKEN=${{ secrets.GPR_TOKEN }} tags: | - ghcr.io/eyblockchain/timber-updated:latest + ghcr.io/eyblockchain/multiple-contracts:with-health-check # username: ${{ github.actor }} # password: ${{ secrets.GITHUB_TOKEN }} push: true diff --git a/merkle-tree/src/routes/node.routes.js b/merkle-tree/src/routes/node.routes.js index 3b25ef5..0f05513 100644 --- a/merkle-tree/src/routes/node.routes.js +++ b/merkle-tree/src/routes/node.routes.js @@ -207,6 +207,16 @@ async function getRoot(req, res, next) { } } +async function getHealthCheck(req, res, next) { + try { + res.data = "Ok"; + next(); + } catch (err) { + next(err); + } +} + + // initializing routes export default function(router) { // NODE ROUTES @@ -237,4 +247,5 @@ export default function(router) { // ROOT ROUTES router.route('/root').get(getRoot); + router.route('/healthcheck').get(getHealthCheck); }