From d095fa80908c4cdf1c1944b605968fd36d7a8460 Mon Sep 17 00:00:00 2001 From: Pof Magicfingers Date: Tue, 19 Mar 2019 17:49:24 +0100 Subject: [PATCH] fix: bind all hosts --- .gitignore | 2 ++ src/index.js | 2 +- src/server/index.js | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 056b2822..a2d22744 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ typings/ # dotenv environment variables file .env + +docker-compose.yml diff --git a/src/index.js b/src/index.js index 69a3dd65..bca91af8 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,6 @@ const server = new Server({ listen: () => console.log( "GraphQL Server is now running on " + - (port ? `http://localhost:${port}/graphql` : socket) + (port ? `http://[::]:${port}/graphql` : socket) ) }) diff --git a/src/server/index.js b/src/server/index.js index cf6cb0b8..a5be24d4 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -62,11 +62,11 @@ function GraphQLServer(config = DEFAULT_CONFIG) { const unix_socket = typeof config.socket === "string" && config.socket.trim() !== "" - const portOrUnix = unix_socket ? config.socket : config.port + const srvCfg = unix_socket ? { path: config.socket } : { host: "::", port: config.port } const http_server = http .createServer(server) - .listen(portOrUnix, config.listen) + .listen(srvCfg, config.listen) if (unix_socket) { http_server.on("listening", () => {