DrupalClient
A powerful client to fetching Drupal JSON:API data.
⚠️
The `DrupalClient`
is available in `next-drupal ^1.3.0`
as experimental.
The `DrupalClient`
is an optional feature. You can safely upgrade your site to `next-drupal 1.3.0`
without any breaking changes.
The `DrupalClient`
is a powerful JSON:API client that ships with helpers for fetching Drupal data and building pages.
It is a replacement for functional helpers such as `getResource`
, `getResourceCollection`
...etc.
Features
- Customizable JSON:API client for data fetching.
- Helpers to fetching resources, menus, views and search indices.
- Support for custom auth (
`Bearer`
,`Basic`
or bring your own). - Support for custom serializers.
- Support for custom fetcher.
- Support for cached resources (memory cache, redis...etc).
- Improved error messages.
Usage
import { Experimental_DrupalClient as DrupalClient } from "next-drupal"
const drupal = new DrupalClient("https://example.com")
// Fetch articles.const articles = await drupal.getResourceCollection("node--article")
👉
See the guide here to upgrade your site to use the new `DrupalClient`
.