0.0.9 • Published 1 year ago
contentful-wrapper v0.0.9
Contentful Wrapper
Configuration
To fetch data from Contentful, use in the .env file
CONTENTFUL_SPACE_ID=
CONTENTFUL_ACCESS_TOKEN=To run the test and dump the data, use in the .env file
MONGO_CONNECTION_STRING=Setup
Ensure to set the contentful spaceID and AccessToken
const Contentful = require('contentful-sync');
const contentfulObj = new Contentful();Methods
You can pull the following details from Contentful
- Assets
- Published Entries
- model3d
- simulations
- studyGuide
- subjects
- tag
- topic
To get all Assets,
const processEntries = true
contentfulObj.getAssets(processEntries)processEntries will strip away the sys notation by Contentful
To get all entities,
const processEntries = true
const type = 'model3d'
contentfulObj.getAllPublishedEntriesOfType(type, processEntries)processEntries will strip away the sys notation by Contentful
type can be any one of model3d, simulations, studyGuide, subjects, tag, topic