Created
January 22, 2018 15:32
-
-
Save onefriendaday/228995f4def9731ad722005dfb83dd37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const StoryblokClient = require('storyblok-js-client') | |
let Storyblok = new StoryblokClient({ | |
accessToken: 'YOUR_TOKEN' | |
}) | |
let lastPage = 1 | |
for (var i = 1; i <= lastPage; i++) { | |
await Storyblok.get('cdn/stories', { | |
version: 'published', | |
per_page: 25, | |
page: i | |
}).then((res) => { | |
let stories = res.data.stories | |
stories.forEach((story) => { | |
// WRITE TO FILESYSTEM | |
// story.content | |
}) | |
let total = res.total | |
lastPage = Math.ceil((res.total / 25)) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment