rivet-dev/rivetkit

Vue Support

Opened this issue · 3 comments

Vue Support
xar commented

fyi - if anyones wants to use it in nuxt:

// .env
NUXT_PUBLIC_ACTORS_ENDPOINT=http://localhost:6097/actors

// plugins/actors.ts
import { createClient } from 'actor-core/client';
import type { AppType } from '...';

export default defineNuxtPlugin(() => {
    const { actorsEndpoint } = useRuntimeConfig().public;

    const actors = createClient<AppType>(actorsEndpoint as string);

    return {
        provide: {
            actors,
        },
    };
});

then calling via:
$actors.chatRoom....
in app

This could be packaged as a very simple Vue plugin and also as a equally simple Nuxt module. I am intending to use Rivet for my next project (using Nuxt) so could potentially create the plugin/module for it if this seems like a good plan?