Skip to content

Commit 11a18fc

Browse files
committed
feat: add pages router example to client intro page
1 parent 9dcc592 commit 11a18fc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

www/content/docs/client.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,18 @@ const article = await drupal.getResource(
4646

4747
### Pages Router
4848

49-
TODO
49+
```ts
50+
import { NextDrupalPages } from "next-drupal"
51+
52+
// Create a new DrupalClient.
53+
const drupal = new NextDrupalPages("https://example.com")
54+
55+
// Fetch articles.
56+
const articles = await drupal.getResourceCollection("node--article")
57+
58+
// Fetch one article by id.
59+
const article = await drupal.getResource(
60+
"node--article",
61+
"f4c61473-8297-4bf3-bab7-21c9633a7ca7"
62+
)
63+
```

0 commit comments

Comments
 (0)