Repository hapi-nuxt

gbruins-notours

gbruins-notours posted a new bug report

hapi-nuxt • 2 months ago

bug Can't use nuxt-edge because 'nuxt' is being imported

Version

1.0.1

Reproduction link

https://github.com/nuxt-community/hapi-nuxt/blob/eabb59352655e11352ae8b4a128e2d4defca16f5/src/index.js#L2

Steps to reproduce

This might be a moot point in the near future when Nuxt2 is released, but for now users of hapi-nuxt can no use nuxt-edge because 'nuxt' is being imported on this line:
https://github.com/nuxt-community/hapi-nuxt/blob/eabb59352655e11352ae8b4a128e2d4defca16f5/src/index.js#L2

What is expected ?

To be able to use nuxt-edge

What is actually happening?

Cant use nuxt-edge because 'nuxt' is being imported

gbruins-notours

gbruins-notours posted a new question

hapi-nuxt • 2 months ago

Can't use nuxt-edge because 'nuxt' is being imported

This might be a moot point in the near future when Nuxt2 is released, but for now users of hapi-nuxt can no use nuxt-edge because 'nuxt' is being imported on this line:

https://github.com/nuxt-community/hapi-nuxt/blob/eabb59352655e11352ae8b4a128e2d4defca16f5/src/index.js#L2

victorhramos

victorhramos posted a new question

hapi-nuxt • 6 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

```javascript
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
},
},
});

server.route({
    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`);

}

start().catch(console.error);

And at my store/index.js:

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

pruge

pruge posted a new question

hapi-nuxt • 9 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

KennyWho posted a new question

hapi-nuxt • 10 months ago

Support hapi v17.

The latest version is v17, PLZ upgrade the plugin.

TheForgotten69

TheForgotten69 posted a new question

hapi-nuxt • a year ago

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

Nervemind.

SamuelEarl

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

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

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

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?