1

I have a neo4j desktop (1.4.3) database on my Windows PC. in an html code, I am connectecting to the DB using

const driver = neo4j.driver("bolt://IP_ADDRESS:7687", neo4j.auth.basic("neo4j", "PASSWORD"));

After that I query the DB and display the results on the web page (I use leafletjs maps, but this is not the issue)

 var session = driver.session();
   session
  .run(`MATCH....etc.... return ....
    `)
  .subscribe({
     ...... etc

Everything is fine so far. I run the page on my PC or from another PC in my home network, everything is fine. The setting of neo4j is (dbms.default_listen_address=0.0.0.0) no issues there.

The question is how do I expose this page to the colleagues outside my network? Using noip.com, I got a temporary domain mapped to my external IP. I also configured the router to forward port 80.
But when the page Javascript gets loaded on an external client, it tries to connect to neo4j on that client. When I put the external IP addtess in "const driver ..." the connection does not work.

How do I make the connection to the DB from my server, but the queries to the DB come from the client who loaded the Javascript?

Edit: Forgot to mention that I am also using Apache Web Server (Xampp) to serve the page to remote users.

FEldin
  • 131
  • 7

1 Answers1

0

A simple architecture that does what you want, plus mitigates the risk of opening up your database to everyone uses a HTTP server + API that are accessible via your noip provider.

Your public facing frontend (HTML + JavaScript (for making API calls etc)) makes the HTTP(s) calls to your publicly accessible API (for example a nodejs server) to make the database calls. Cypher/a direct database connection to neo has no place in your users' browsers.

You can also use a starter like the GRANDstack.

manonthemat
  • 6,101
  • 1
  • 24
  • 49