Skip to content

refactor: health check --update - #22

Merged
EmmanuelAdah merged 1 commit into
mainfrom
microdev
Jun 15, 2026
Merged

refactor: health check --update#22
EmmanuelAdah merged 1 commit into
mainfrom
microdev

Conversation

@EmmanuelAdah

@EmmanuelAdah EmmanuelAdah commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added products API endpoint
    • Added server health check endpoint displaying status, uptime, and memory usage
  • Chores

    • Added HTTP client dependency

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d2666109-bd29-4906-8f3d-212638788006

📥 Commits

Reviewing files that changed from the base of the PR and between 81ee514 and 7da7fe1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • app.js
  • package.json
  • server.js
  • test/product.test.js
  • utils/keepServer.js

📝 Walkthrough

Walkthrough

Adds a /health GET endpoint to server.js returning runtime diagnostics (uptime, timestamp, memory usage) with HTTP 200/503 status. Creates utils/keepServer.js to ping that endpoint via axios every 45 minutes. Adds axios to dependencies. Mounts /products in app.js and refactors product tests to use the shared app instance.

Changes

Health Check Infrastructure and Products Route Wiring

Layer / File(s) Summary
/health endpoint and keepServer periodic utility
server.js, utils/keepServer.js, package.json
server.js adds a /health GET route returning status, uptime, timestamp, and memoryUsage (HTTP 200), falling back to status: 'DOWN' with HTTP 503 on error. utils/keepServer.js is created to run an axios GET against HEALTH_CHECK_URL every 45 minutes, logging either the response data or 'Server is down'. axios ^1.18.0 is added to package.json.
/products route wiring and test refactor
app.js, test/product.test.js
app.js registers productRoutes at /products. product.test.js removes inline Express app construction and mounts, replacing them with an import of the shared app from ../app.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • EmmanuelAdah/PanAfrik_Store#7: Directly modifies routes/productRouter.js and controllers/productController.js, which are wired into the app via the /products route registration added in this PR.

Poem

🐇 Hippity-hop, the server's alive,
A /health endpoint helps it survive!
Every 45 minutes, a ping goes out,
keepServer checks what it's all about.
Products now routed, tests neat and trim —
This bunny keeps servers from going dim! 🌟

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch microdev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EmmanuelAdah
EmmanuelAdah merged commit 45ea316 into main Jun 15, 2026
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant