Skip to content

Commit

Permalink
fix: bind all hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
Pof Magicfingers committed Mar 19, 2019
1 parent 6b64819 commit d095fa8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ typings/

# dotenv environment variables file
.env

docker-compose.yml
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
})
4 changes: 2 additions & 2 deletions src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down

0 comments on commit d095fa8

Please sign in to comment.