Verify the database connection
Confirm that the server-side page can read live PloyDB records.
row_3aa41db98f54f528b8e8
Request flow
The database stores three typed rows in the Demo tasks table.
The route calls the PloyDB client for every page request. This page is not prerendered.
A read-only token is loaded from a server secret and scoped to this table.
The client maps field IDs into title, description, status, and priority properties.
Edit a record in PloyDB, then refresh this route. The page reads the new value without copying rows into source files.
Confirm that the server-side page can read live PloyDB records.
row_3aa41db98f54f528b8e8
Map immutable field IDs to friendly names before rendering.
row_a01f4d8ada4a8741c5f8
Change this record later to prove the page updates without code changes.
row_6475f304387938f1fa12
Under the hood
IDs are safe to keep in source. The bearer token is not. The route imports the client only in Astro server code, so the browser never receives the secret.
HTTP request
POST ${PLOYDB_GATEWAY_URL}/site/v1/ploydbs/pdb_4d6ad9f9ad0e462eb5a2/tables/tbl_c45281dd298a470cae89/query
Authorization: Bearer <server-only token>
Content-Type: application/json
{
"sort": [{ "field": "fld_6535910fb4444790", "dir": "asc" }],
"limit": 10
}Field mapping
Route code
const { rows, error } = await demoDb.queryRowsResult(
DEMO_TASKS_TABLE,
DEMO_TASK_FIELDS,
{
sort: [{ field: DEMO_TASK_FIELDS.priority, dir: "asc" }],
limit: 10,
},
PREVIEW_DEMO_TASKS,
);Open PloyDB, choose PloyDB Runtime Demo, edit any Demo tasks row, save it, and refresh this page. No page code or rebuild is needed for the data change.
Return to live records