Skip to content

Drupal router for Nuxt, powered by the Drupal Decoupled Router module.

DruxtRouterNuxtModule

View source on GitHub

DruxtRouterNuxtModule(moduleOptions)

The Nuxt.js module function.

  • Extends the Vue router, adding the Druxt wildcard route.
  • Adds the Druxt router plugin.
  • Adds the Druxt router Vuex store.

The module function should not be used directly, but rather installed via your Nuxt configuration file.

Options are set on the root level druxt Nuxt config object.

A Nuxt module configures the Nuxt application, and is unrelated to a Drupal module.

Kind: global function
See

ParamTypeDescription
moduleOptionsobjectThe Nuxt.js module options.

Properties

NameTypeDefaultDescription
options.druxtobjectDruxt root level options.
options.druxt.baseUrlstringBase URL of the Drupal JSON:API backend.
[options.druxt.endpoint]string"/jsonapi"The Drupal JSON:API endpoint path.
[options.druxt.axios]objectAxios settings for the DruxtRouter client.
[options.druxt.proxy.api]booleanProxy JSON:API requests on the client side.
[options.druxt.router.render]stringName of the component used to render the resolved route.

Example

// `nuxt.config.js`
module.exports = {
  buildModules: ['druxt-router/nuxt'],
  druxt: {
    baseUrl: 'https://demo-api.druxtjs.org'
  }
}