Add kentico cloud super power to your nuxt app
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
lib
tests
.babelrc
.eslintignore
.eslintrc.json
.gitignore
README.md
package-lock.json
package.json
rollup.config.js
yarn.lock

README.md

CircleCI semantic-release

kenticocloud-nuxt-module

Add kentico cloud super power to your nuxt app

Features

The module makes it easy to do delivery client api calls via the Kentico Cloud Delivery SDK.

Quick start

  • Install via npm
npm i kenticocloud-nuxt-module --save
npm i rxjs --save (because this is a peer dependency of the Kentico Cloud Delivery SDK)

  • Add kenticocloud-nuxt-module to modules section of nuxt.config.js
  /*
  ** Nuxt.js modules
  */
  modules: [
    'kenticocloud-nuxt-module'
  ],
  kenticocloud: {
    projectId: 'xxxx-xxx-xxxx-xxxx-xxxxx',
    enableAdvancedLogging: false,
    previewApiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
  },
  • $deliveryClient is now globally available.
 this.$deliveryClient.items()
    .type('page')
    .getPromise()
    .then(response => console.log('DeliveryClient Response', response));

Note:

By default Nuxt can only work with promises. Therefor you always use the "getPromise" method provided by the Kentico Cloud Delivery SDK! RxJs operator's are not supported at the moment.

Caching

API calls can be "cached" (they will be stored in memory) client side via the "viaCache" method.

 const query =  this.$deliveryClient.items().type('page');
 const cacheSeconds = 30;
 this.$deliveryClient.viaCache(query, cacheSeconds)
        .then(response => console.log('DeliveryClient Response', response));