Skip to content

Instantly share code, notes, and snippets.

@marcolink
Last active July 28, 2023 07:51
Show Gist options
  • Save marcolink/2c29479999bc1214e5f11f61baf5b38a to your computer and use it in GitHub Desktop.
Save marcolink/2c29479999bc1214e5f11f61baf5b38a to your computer and use it in GitHub Desktop.
Use contentful sdk/library with fetch adapter

Use contentful sdk with axio fetch adapter

install

npm install contentful
npm install @vespaiach/axios-fetch-adapter

instantiate contentful client with fetch adapter

import { createClient } from 'contentful';
import fetchAdapter from '@vespaiach/axios-fetch-adapter';

// the same works for contentful-management
const client = createCLient({
  space: '<space-id>',
  accessToken: '<access-token>',
  adapter: fetchAdapter
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment