Repository hapi-nuxt


victorhramos posted a new question

hapi-nuxt • 4 months ago

What about sessions

Tried to get sessions working with hapi-server-session but it seens to not are sent to nuxtServerInit
This is my server.js

const {Server} = require('hapi');
const hapiNuxt = require('hapi-nuxt'); // 'hapi-nuxt'

async function start() {
const server = new Server({port: 3000});
await server.register(hapiNuxt);
await server.register({
plugin: require('hapi-server-session'),
options: {
cookie: {
isSecure: false, // never set to false in production

    method: 'POST',
    path: '/ssd',
    handler: function (req, h) {
        req.session.ssd = req.payload.ssd;
        return {
            ok: true,
            ssd: req.session.ssd


await server.start();

console.log(`Hapi server listening on http://localhost:3000`);



And at my store/index.js:

nuxtServerInit({state, commit}, {req}) {
if (req.session && req.session.ssd) {
commit('restoreState', req.session.ssd)
with console.log(req.session) receiving undefined


pruge posted a new question

hapi-nuxt • 7 months ago

options proposal

Pass only required properties

  await server.register({
    plugin: HapiNuxt,
    options: {
      // path: '../../nuxt.config.js',
      dev: !(process.env.NODE_ENV === 'production')
  async register(server, options = {}) {
    // If options.path is not provided try nuxt.config.js
    if (!options.path) {
      options.path = 'nuxt.config.js'

    // Resolve config location if is provided as string
    if (typeof options.path === 'string') {
      try {
        const path = resolve(process.cwd(), options.path)
        config = require(path)
      } catch (e) {
        // DO NOTHING

    delete options.path
    Object.assign(config, options)


KennyWho posted a new question

hapi-nuxt • 8 months ago

Support hapi v17.

The latest version is v17, PLZ upgrade the plugin.


TheForgotten69 posted a new question

hapi-nuxt • 9 months ago

What are the difference between this plugin as opposed to just plug hapi like in the express template ?



SamuelEarl posted a new question

hapi-nuxt • a year ago

Can we get a tutorial? I would be willing to help write it.

Hi. Thank you for creating this plugin. I have been trying to figure out how to connect hapi.js and Vue.js for awhile now and I came across this plugin recently.

I am trying to get this plugin to work with a hapi.js project that I am working on, but I keep getting errors. I am sure that I have some errors with my configs, but I don't know where I am going wrong. A tutorial would be much appreciated. I would be willing to help write it with your direction.

Please let me know what I can do to help and I would be glad to contribute.

Thank you!


prasadsilva posted a new question

hapi-nuxt • a year ago

Pin exact versions

Semver is picking up rc-3 instead of alpha-3. This is an issue since the alpha-3 code in this repo is not compatible with nuxt rc-3. Thanks!


ggn06awu posted a new question

hapi-nuxt • a year ago

redirect's not working in SSR

Thanks for the effort!

Got this up and running with your latest release, only one bug so far, the redirect isn't doing anything in the server side render. For instance, a super simple Nuxt middleware might look like this:-

export default function ({ store, route, redirect, error }) {
if (!store.state.user.authenticated && route.path !== '/login') {
return redirect('/login')

However, though i get a 302 header back from the server when the server runs that and wants to redirect, it doesn't include the HTTP Location header, any ideas?


pawel-miczka posted a new question

hapi-nuxt • a year ago

Some tutorial?

Can u write some tutorial how to connect Hapi with Nuxt using this?