Unable to establish neo4j-bolt driver connection in javascript

I am trying to create a connection between my embedded javascript html and my neo4j base by running index.html in Chrome. I reduced the source of the problem to "neo4j", which is not recognized. Thus, the error encountered will be of the type:

Unable to read property ['driver' / 'basic' / etc ...] from undefined.

In this case, I assumed that "undefined" refers to "neo4j", which means that I am not correctly implementing "neo4j-web.min.js".

The following code block is extracted from my index.html and was taken from: https://www.npmjs.com/package/neo4j-driver

<script src="node_modules/neo4j-driver/lib/browser/neo4j-web.min.js"></script> <script type="text/javascript" charset="utf-8"> var driver = neo4j.driver("bolt://localhost:7474", neo4j.auth.basic(neo4j, neo4j)); </script> 

Given that the problem seems very localized for this code, I spared everyone else. If there is no further context, I would be happy to provide it.

+5
source share
2 answers

The neo4j-driver module uses an odd system in which you need to specify which version of the API you want to use.

 <script src="node_modules/neo4j-driver/lib/browser/neo4j-web.min.js"></script> <script type="text/javascript" charset="utf-8"> neo4j = neo4j.v1 var driver = neo4j.driver("bolt://localhost:7474", neo4j.auth.basic(neo4j, neo4j)); </script> 
+5
source

I agree with @varbrad My 2cts: check the server name You are using the localhost alias

+1
source

Source: https://habr.com/ru/post/1268259/


All Articles