How to interact with Janusgraph using NodeJs


mo...@...
 

Hi,

I am new to Janusgraph and want to try how I can interact with it using Node Js. Do I need to configure my gremlin server to allow remote connections? I am not sure how exactly that is to be done. Please help.

I get the following error when I try to run my nodejs code

const gremlin = require('gremlin');
const Graph = gremlin.structure.Graph;
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
const graph = new Graph();
const g = graph.traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));
g
.V().has('lead', 'leadLeadId', '30087713').values('leadLeadId').toList().then(function(res){console.log(res)},function(err){console.log('Hi');console.log(err)});
Promise {
 
<pending>,
  domain
:
   
Domain {
     domain
: null,
     _events
: { error: [Function: debugDomainError] },
     _eventsCount
: 1,
     _maxListeners
: undefined,
     members
: [] } }
> Hi
Error: Server error: The traversal source [g] for alias [g] is not configured on the server. (499)
    at DriverRemoteConnection._handleMessage (/home/mohit/node_modules/gremlin/lib/driver/driver-remote-connection.js:180:9)
    at
WebSocket.DriverRemoteConnection._ws.on.data (/home/mohit/node_modules/gremlin/lib/driver/driver-remote-connection.js:72:41)
    at emitOne
(events.js:116:13)
    at
WebSocket.emit (events.js:211:7)
    at
Receiver._receiver.onmessage (/home/mohit/node_modules/gremlin/node_modules/ws/lib/WebSocket.js:141:47)
    at
Receiver.dataMessage (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:380:14)
    at
Receiver.getData (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:330:12)
    at
Receiver.startLoop (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:165:16)
    at
Receiver.add (/home/mohit/node_modules/gremlin/node_modules/ws/lib/Receiver.js:139:10)
    at
Socket._ultron.on (/home/mohit/node_modules/gremlin/node_modules/ws/lib/WebSocket.js:138:22)



Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.