IMPORTANT: This plugin is compatible with Hapi >= 17
@nuxtjs/hapi
dependency to your projectyarn add @nuxtjs/hapi # or npm install @nuxtjs/hapi
const Hapi = require('@hapi/hapi')
const nuxtPlugin = require('@nuxtjs/hapi')
await server.register({
plugin: nuxtPlugin
options: {
// plugin options
}
}
dev
true
(false
when environment variable NODE_ENV
is production
)Automatically starts a Builder
allow to hot reload on dev. Should be disabled for production.
overrides
Override nuxt.config
rootDir
Nuxt app rootDir
edge
false
Use nuxt-edge
instead of nuxt
package if set to true
baseURL
/
baseURL for SSR route handler
route
{ id: 'nuxt.render', auth: false }
Hapi route options for SSR handler
routeMethod
*
Hapi route method. (Can be set to GET
for more strict handling)
nuxt
and builder
instancesThis plugin exposes nuxt and builder (for dev only) instances to hapi.
const server = new Hapi.Server()
await server.register(HapiNuxt)
// Access to nuxt and builder instances using server.plugins.nuxt
const { nuxt, builder } = server.plugins.nuxt
The hapi request object is available from nuxtServerInit
and the context
under res.hapi
. Likewise, the hapi response toolkit will be available in res.hapi
.
yarn install
or npm install
npm run dev
Copyright (c) Nuxt Community