nebula-contrib / nebula-node

Nebula Graph Client for Node.js
26 stars 9 forks source link

Published to npmjs, versioned as 2.6.1 #10

Closed wey-gu closed 2 years ago

wey-gu commented 2 years ago
npm install @nebula-contrib/nebula-nodejs
// ESM
import { createClient } from '@nebula-contrib/nebula-nodejs'

// CommonJS
// const { createClient } = require('@nebula-contrib/nebula-nodejs')

// Connection Options
const options = {
  servers: ['ip-1:port','ip-2:port'],
  userName: 'xxx',
  password: 'xxx',
  space: 'space name',
  poolSize: 5,
  bufferSize: 2000,
  executeTimeout: 15000,
  pingInterval: 60000
}

// Create client
const client = createClient(options)

// Execute command
// 1. return parsed data (recommend)
const response = await client.execute('GET SUBGRAPH 3 STEPS FROM -7897618527020261406')
// 2. return nebula original data
const responseOriginal = await client.execute('GET SUBGRAPH 3 STEPS FROM -7897618527020261406', true)
wey-gu commented 2 years ago

@wujjpp could you please take a look at this PR :)