From 11a18fc6bada811f26bee4b87ee690c829d271a3 Mon Sep 17 00:00:00 2001 From: Brian Perry Date: Tue, 5 Nov 2024 11:00:58 -0600 Subject: [PATCH] feat: add pages router example to client intro page --- www/content/docs/client.mdx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/www/content/docs/client.mdx b/www/content/docs/client.mdx index a286d01d..e6f4b637 100644 --- a/www/content/docs/client.mdx +++ b/www/content/docs/client.mdx @@ -46,4 +46,18 @@ const article = await drupal.getResource( ### Pages Router -TODO +```ts +import { NextDrupalPages } from "next-drupal" + +// Create a new DrupalClient. +const drupal = new NextDrupalPages("https://example.com") + +// Fetch articles. +const articles = await drupal.getResourceCollection("node--article") + +// Fetch one article by id. +const article = await drupal.getResource( + "node--article", + "f4c61473-8297-4bf3-bab7-21c9633a7ca7" +) +```