Created
February 17, 2020 16:43
-
-
Save hisasann/8b1277c117c28fbf1ed57b343690122a to your computer and use it in GitHub Desktop.
contentful で getEntry する簡単なサンプル
This file contains 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 contentful = require("contentful"); | |
const client = contentful.createClient({ | |
// This is the space ID. A space is like a project folder in Contentful terms | |
space: "ra794i9t0yln", | |
// This is the access token for this space. Normally you get both ID and the token in the Contentful web app | |
accessToken: "U1Wffn5NIhptGsWKyliQCILCWpoaCjJK6mwJwYO_58g" | |
}); | |
// This API call will request an entry with the specified ID from the space defined at the top, using a space-specific access token. | |
client.getEntries() | |
.then((response) => console.log(response.items)) | |
.catch(console.error) | |
client.getEntry('7gXAjvVRrjBMK4XbuJ8TVO') | |
.then((entry) => console.log(entry)) | |
.catch(console.error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment