You are reading the documentation for v0, which is no longer the latest version. Switch to v1
Nuxt module
This document explains how Nuxt module is implemented. As all it is doing right now is registering a Nuxt plugin. We focus on that part.
Plugin
It:
- checks for presence of required environment variables,
- builds config for Coveo Headless,
- builds Coveo engines, namely SSR engine, Product Recommendation engine, and Search engine,
- builds Coveo controllers which could be instantiated only once, namely SearchBox controller, and InstantResults controller,
- provides it to the Nuxt app.
Then you can access config, engines, and controllers using useNuxtApp composable:
const {
$coveo: {
config: coveoEngineConfig,
server: {
engineDefinition: coveoSSREngine,
fetchStaticState: coveoSSREngine.fetchStaticState,
hydrateStaticState: coveoSSREngine.hydrateStaticState,
},
client: {
engines: {
headlessEngine,
productRecommendationsEngine,
},
controllers: {
searchBox,
instantResults,
},
},
}
} = useNuxtApp();We also use it internally in prepared by us Composables and Components.