How to use the @feathersjs/client.rest function in @feathersjs/client

To help you get started, we’ve selected a few @feathersjs/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nesterow / frontless / src / lib / client.js View on Github external
all: [(context) => {
      const {opts} = context.result;
      if (typeof opts === 'object' &&
          opts._t === '/m/') {
        evbus.trigger('update:' + opts._id, context.result.data);
      }
      return Promise.resolve(context);
    }],
  },
};

const endpoint = process.settings.origin;


const ws = io(endpoint);
const rest = feathers.rest(endpoint);

const app = feathers();
const wsc = feathers();


app.configure(rest.axios(axios));
wsc.configure(socketio(ws, {
  timeout: 2000,
}));

wsc.hooks(hooks);
app.hooks(hooks);
app.io = wsc;
app.ws = ws;

export default app;
github nesterow / frontless / client.js View on Github external
}

  if (request) {
    hooks = {
      before: {
        all: [(ctx) => {
          ctx.params.accessToken = request.cookies [COOKIE_NAME]
        }]
      }
    }
  }
  
  const endpoint = (isClient ? location.origin : process.env.ORIGIN) || 'http://localhost:6767'
  
  
  const rest = feathers.rest(endpoint)
  const app = feathers()

  app.configure(rest.axios(axios))
  app.configure(auth(authOptions))
  app.hooks(hooks)


  if (isClient && WEBSOCKETS) {
    const wsc = feathers()
    const ws = io(endpoint)
    wsc.configure(auth(authOptions))
    wsc.configure(socketio(ws, {
      timeout: 2000,
    }))
    wsc.hooks(hooks)
    app.io = wsc
github nesterow / frontless / src / client.js View on Github external
const endpoint = 'http://localhost:8000';

const app = feathers()
if (typeof window !== 'undefined') {
  const ws = io(endpoint)
  const wsc = feathers()
  wsc.configure(socketio(ws, {
    timeout: 2000,
  }));
  wsc.hooks(hooks)
  app.io = wsc
  app.ws = ws
  
}

const rest = feathers.rest(endpoint)

app.configure(rest.axios(axios))
app.hooks(hooks)


export default app

@feathersjs/client

A module that consolidates Feathers client modules for REST (jQuery, Request, Superagent) and Websocket (Socket.io, Primus) connections

MIT
Latest version published 17 days ago

Package Health Score

90 / 100
Full package analysis