Skip to content

Deep Ping

Method

REST method is adopted.

HTTP Method

GET: Database connectivity health check

Naming Convention

To unify naming of query parameters and nodes and improve readability, snake_case is used for URIs and nodes in JSON during requests.

Request and Response

Headers

Meta information is set in HTTP headers rather than in the response body.

Request Headers

No request headers required.

Response Headers

  • Content-Type: application/json

Deep Ping

URI

/api/v1/ping/deep

Response (200 OK)

Response is JSON.

{
  "message": "deep ping"
}

Authentication

This endpoint does not require authentication.

Exception Handling

Exception handling status codes are as follows.

Description Status Code Status Name
Internal server error 500 Internal Server Error

Process Flow

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Hono Router
    participant Service as Ping Service
    participant Repo as Ping Repository
    participant DB as PostgreSQL Database

    Client->>API: GET /api/v1/ping/deep
    API->>Service: pingDeep()
    Service->>Repo: pingDeep()
    Repo->>DB: SELECT 1

    alt Database Connected
        DB-->>Repo: Query result
        Repo-->>Service: "deep ping"
        Service-->>API: "deep ping"
        API-->>Client: 200 OK { "message": "deep ping" }
    else Database Error
        DB-->>Repo: Connection error
        Repo-->>Service: throw Error
        Service-->>API: throw Error
        API-->>Client: 500 Internal Server Error
    end

Routes Layer

API routing is performed here. The handler delegates to the ping service and returns the result as a JSON response.

Source: apps/admin/src/routes/v1/ping.ts

Services Layer

This section describes business logic. It calls the repository to perform a database connectivity check and returns the result message.

Source: apps/admin/src/services/ping.ts

Repositories Layer

This section describes access to databases. It executes a lightweight SELECT 1 query to verify the database connection. If the query succeeds, it returns "deep ping". If the connection fails, it logs the error and throws an exception.

Source: apps/admin/src/repositories/ping.ts

Security

  • No authentication required for health check purposes
  • No sensitive information exposed in the response
  • Database errors are logged with context but not exposed to the client
  • Suitable for readiness probes and deployment verification