Package Exports
- contentful
- contentful/dist/contentful
- contentful/questor.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (contentful) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
contentful.js
Javascript client for Contentful's Content Delivery API:
- Documentation
- Example Apps
- Tests running in node and browsers via BrowserStack
Install
In node, using npm:
npm install contentfulIn a browser, using bower:
bower install contentful
# After installing, add this as a script tag:
# <script src="components/contentful/dist/contentful.min.js"></script>Latest contentful.min.js.
Note: The next minor version release of dist/contentful.min.js will
be much smaller. Please use a package manager to keep your JS
dependencies up to date and get the newest version right when it's
ready!
Usage
// Don't require if you've already included contentful as a script tag
var contentful = require('contentful');
var client = contentful.createClient({
// ID of Space
space: 'cfexampleapi',
// A valid access token within the Space
accessToken: 'b4c0n73n7fu1',
// Enable or disable SSL. Enabled by default.
secure: true
});
var log = console.log.bind(console); // wat
// Get Space
client.space().then(log, log);
// Get all Entries
client.entries().then(log, log);
// Get Assets using callback interface
client.entries({}, function(err, entries) {
if (err) { console.log(err); return; }
console.log(entries);
});For now, please check out the Content Delivery API documentation to learn how the API and the JavaScript client work.
License
MIT
