strapi-client-core
v1.1.8
Published
Strapi client
Downloads
46
Maintainers
Keywords
Readme
Strapi Client - Integration with Strapi-CMS
A strapi-client
library to fetch data from Strapi-CMS
for static sites.
Example Usgae
const client = require('strapi-client');
const dataPath = './data'
const mediaPath = './media'
const url = process.env.GATEWAY_URL
const token = process.env.GATEWAY_TOKEN
client.fetch(`${url}/graphql`, token)
/** Write data to target dir **/
.then((res) => client.write(url, token, res, dataPath, mediaPath)
.catch(err => {
console.log('Failed to fetch data: ', error?.message || error)
}));