/ / Express.js-なぜLocalhost '::' - node.js、express、localhost

Express.js-なぜLocalhost '::' - node.js、express、localhost

誰でも私のサーバーアドレス(ホスト)が:: localhostでない理由を教えてもらえますか?

var express = require("express");
var app = express();

// respond with "hello world" when a GET request is made to the homepage
app.get("/", function(req, res) {
res.send("hello world");
});

var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log("Example app listening at http://%s:%s", host, port);
});

これは返す

Example app listening at http://:::3000

私が行くとうまくいく http://localhost:3000/

回答:

回答№1は5

IPv6を使用しているときは::がlocalhostなので、IPv4の場合と同じように127.0.0.1です。