How to use the kuzzle-sdk.Http function in kuzzle-sdk

To help you get started, we’ve selected a few kuzzle-sdk 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 kuzzleio / sdk-javascript / doc / 6 / protocols / http / constructor / snippets / constructor.js View on Github external
} = require('kuzzle-sdk');

const customRoutes = {
  'nyc-open-data-plugin/driver': {
    enroll: { verb: 'POST', url: '/_plugin/nyc-open-data-plugin/drivers' },
    remove: { verb: 'DELETE', url: '/_plugin/nyc-open-data-plugin/drivers/:driverId' }
  }
};

const options = {
  customRoutes,
  sslConnection: false
};

// Instantiates the Http protocol
const httpProtocol = new Http('kuzzle', options);

// Use it with Kuzzle
const kuzzle = new Kuzzle(httpProtocol);
github kuzzleio / kuzzle / features-sdk / support / hooks.js View on Github external
function getProtocol (world) {
  let protocol;

  switch (world.protocol) {
    case 'http':
      protocol = new Http(world.host, { port: world.port });
      break;
    case 'websocket':
      protocol = new WebSocket(world.host, { port: world.port });
      break;
    default:
      throw new Error(`Unknown protocol "${world.protocol}".`);
  }

  return protocol;
}
github kuzzleio / kuzzle / features-sdk / support / world.js View on Github external
_getSdk () {
    let protocol;

    switch (this.protocol) {
      case 'http':
        protocol = new Http(this.host, { port: this.port });
        break;
      case 'websocket':
        protocol = new WebSocket(this.host, { port: this.port });
        break;
      default:
        throw new Error(`Unknown protocol "${this.protocol}".`);
    }

    return new Kuzzle(protocol);
  }
}

kuzzle-sdk

Official Javascript SDK for Kuzzle

Apache-2.0
Latest version published 5 months ago

Package Health Score

69 / 100
Full package analysis