1.0.0 • Published 8 years ago

contentful-db v1.0.0

Weekly downloads
2
License
Public Domain
Repository
github
Last release
8 years ago

contentful-db

Contentful database downloader / parser for use in the browser.

Why

If you have <= 1k entries, your database is likely to compress very well (Contentful's content delivery API uses gzip) which means it's generally quite feasible to download the entire thing at page load.

How

XMLHttpRequest

Example

var Contentful = require('contentful-db')

var db = new Contentful({
  space: 'WWW',
  key: 'XXX',
  contentTypes: {
    'YYY': 'pages',
    'ZZZ': 'menus'
  }
})

db.load(function () {
  console.log(db.entries)
  var pages = db.find({ type: 'pages' })
  pages.forEach(function (page) {
    console.log(page)
  })
})

License

Public Domain

1.0.0

8 years ago