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:
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
-
Type:
String
-
Default:
collection
-
Values:
'collection' || 'single'
-
Type:
Example
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.
export default {
strapi: {
key: 'userJwt'
}
}
expires
v0.2.0+
-
Type:
String
orNumber
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
export default {
strapi: {
expires: '31d'
}
}
cookie
v0.2.0+
-
Type:
Object
-
Default:
{}
Options to forward to the cookie#options module, the expires
property will be overwritten.
export default {
strapi: {
cookie: {
sameSite: 'lax'
}
}
}