feathersjs-ecosystem / feathers-vuex

Integration of FeathersJS, Vue, and Nuxt for the artisan developer
https://vuex.feathersjs.com
MIT License
445 stars 110 forks source link

serverAlias example #548

Open corepay opened 3 years ago

corepay commented 3 years ago

Hello @marshallswain

I've been using feathers-vuex for a bit now as central to 4 different apps currently in production all tied to one feathers server, so everything checks out ok and works fine according to your well documented instructions.

Now I am going to break my feathers server into 3 or 4 servers -> all using the same db but each with a different context. Each of my apps will need to be able to communicate with each server - more specifically authenticate. Same user can login to app1, app2, app3, app4 with same creds and receive a feathers JWT which should authenticate subsequent requests no matter what server I am accessing. Pretty simple i think using the same DB for auth.

So....see the serverAlias param and been looking in docs and issues for an example of how to setup service alias for multiple servers in relation to how the models would use that alias to route to their respective server. I'm sure it's simple enough but just can't wrap me head around the concept yet. Is it possible you can just provide a sample of how to setup the feathers-client.js for 2 or more serverAliases and where/how to point a model to use that alias?

I thought I could just make multiple copies of feathers-client named for each server and require them in the model then I go stuck on how to do store/index.js for each new *.client.js...

import { FeathersVuex } from './feathers-client'
Vue.use(FeathersVuex)

Any tips here would really help.....

PS: Apps are Quasar SPA - no Nuxt needed here ;)

marshallswain commented 3 years ago

@corepay could you come talk to me in Slack?

marshallswain commented 3 years ago

As part of the changes for getting things to work with Vue 3, I'll be adding an example that shows how to work with multiple servers.