Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 689 Bytes

API.md

File metadata and controls

45 lines (28 loc) · 689 Bytes

API

GET /

Returns a welcome payload.

{ "message": "Hello from Hono!", "docs": "./docs/README.md" }

GET /health

Liveness probe for platforms and smoke tests.

{ "status": "ok" }

POST /echo

Demonstrates @hono/zod-validator on JSON bodies.

Request:

{ "message": "ping" }

Response:

{ "echo": "ping" }

Invalid bodies return 400 from the validator.

Errors

Unhandled errors go through src/middleware/error-handler.ts and return:

{ "error": { "code": "INTERNAL_ERROR", "message": "..." } }

Throw AppError from src/lib/errors.ts for intentional HTTP failures with a custom code and status.