Skip to content

Add /healthz endpoint, integration tests, and test docs#8

Open
ni0520 wants to merge 1 commit intomainfrom
codex/add-health-check-route-and-tests
Open

Add /healthz endpoint, integration tests, and test docs#8
ni0520 wants to merge 1 commit intomainfrom
codex/add-health-check-route-and-tests

Conversation

@ni0520
Copy link
Owner

@ni0520 ni0520 commented Feb 16, 2026

Motivation

  • 新增健康檢查端點以便平台或監控系統能快速確認服務存活狀態。
  • 提供可自動執行的最小整合測試以驗證主要路由與健康檢查行為。

Description

  • index.js 新增 GET /healthz,回傳 200 與 JSON { status: 'ok' },並改為在直接執行時才 listen,同時匯出 app 供測試使用。
  • 新增整合測試 test/integration.test.js,使用 node:test 搭配 supertest 驗證 GET /GET /healthz 的回應。
  • 更新 package.jsontest script 為 node --test 並將 supertest 加入 devDependencies
  • 更新 README.md,新增「如何執行測試」與「健康檢查用途」說明(包含 npm installnpm test 指令)。

Testing

  • 已執行 npm install 以安裝開發相依套件並更新 package-lock.json,安裝過程成功。
  • 已執行 npm test(即 node --test),整合測試結果為 2 個測試通過且無失敗。

Codex Task

@netlify
Copy link

netlify bot commented Feb 16, 2026

Deploy Preview for myapp-52980b ready!

Name Link
🔨 Latest commit 6161990
🔍 Latest deploy log https://app.netlify.com/projects/myapp-52980b/deploys/6993a5ffa0498d000872af38
😎 Deploy Preview https://deploy-preview-8--myapp-52980b.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ni0520 ni0520 self-assigned this Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant