Options

Discover the options of the Strapi module for Nuxt

url

  • Default: process.env.STRAPI_URL || http://localhost:1337

URL of the Strapi server.

Environment variable STRAPI_URL can be used to override url.

entities

  • Default: []

You can specify the entities present in your API. Doing so will define the entities as properties in $strapi so you can access it:

nuxt.config.js
export default {
  strapi: {
    entities: ['products']
  }
}

Then you can use $strapi.products in your application:

await this.$strapi.$products.find()

Entities can also be defined as objects to specify the content type.

  • name
    • Type: String
  • type
    • Type: String
    • Default: collection
    • Values: 'collection' || 'single'

Example

nuxt.config.js
export default {
  strapi: {
    entities: [
      { name: 'homepage', type: 'single' }
    ]
  }
}

Check out the Strapi documentation on API endpoints.

See more in Usage.

key

v0.2.0+
  • Type: String
  • Default: 'strapi_jwt'

Key used for the cookie name as well as localStorage/sessionStorage key.

nuxt.config.js
export default {
  strapi: {
    key: 'userJwt'
  }
}

expires

v0.2.0+
  • Type: String or Number or 'session'
  • Default: 'session'

When expires === 'session', the sessionStorage will be used to act like the cookie.

Otherwise, if the value is a string, it will be parsed using ms, ex: expires: '7d'

A number can also be provided as milliseconds, ex: expires: 7 * 24 * 3600 * 1000

nuxt.config.js
export default {
  strapi: {
    expires: '31d'
  }
}
v0.2.0+
  • Type: Object
  • Default: {}

Options to forward to the cookie#options module, the expires property will be overwritten.

nuxt.config.js
export default {
  strapi: {
    cookie: {
      sameSite: 'lax'
    }
  }
}
Edit this page on GitHub Updated at Thu, Mar 25, 2021