Neo4j node js driver, connection conflict between and localhost

Hello community,

So I am building this express App and I wanted to use neo4j as a database for my project.

When documenting about the connection and implementing it, I got an error which I will leave below, after a lot of reaserche about how to fix that error I still couldn't fix it. But suddenly I got the idea to replace localhost with and it worked and I retrieved data from the database successefully.

Here's the code

and here's the error I got whenever I used localhost instead of

This looks like the database server is not reachable via IPv6. I'm not sure why that is. I usually spin up the server via Docker and that works fine for me (IPv4 and IPv6). You could either tell you OS to not resolve localhost to ::1 (IPv6) but only to (IPv4) or dig into why the database is not reachable under ::1. Or the third option is what you did, connect via a resolved IP address; no host name resolution involved.

1 Like

Yes, I will just let it like this the connection, and get deeper in interacting with the database from node JS and building apps and exploit the power of neo4j in my projects. Because I still didn't study that much about networking and protocols and for the moment I know just the basics about the client/server architecture.
Thanks for the response!