Skip to content

Instantly share code, notes, and snippets.

@betacar
Last active Nov 7, 2017
Embed
What would you like to do?
NuxtJS plugin to integrate FeathersJS and VueJS
'use strict';
import Vue from 'vue';
import Feathers from 'feathers/client';
import VueFeathers from 'vue-feathers';
import hooks from 'feathers-hooks';
import authentication from 'feathers-authentication/client';
// import rest from 'feathers-rest/client';
import rx from 'feathers-reactive';
import RxJS from 'rxjs';
// import axios from 'axios';
import socketio from 'feathers-socketio/client';
import io from 'socket.io-client';
if (process.BROWSER_BUILD) {
// Configure Feathers client
const host = process.env.FEATHERS_HOST || 'http://localhost:3030';
const socket = io(host);
const feathers = Feathers()
.configure(authentication({storage: this.localStorage}))
.configure(socketio(socket))
// .configure(rest(host).axios(axios))
.configure(rx(RxJS))
.configure(hooks());
Vue.use(VueFeathers, feathers);
}
// The feathers instance will be available
// as this.$nuxt.$feathers, instead of this.$feathers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment