¿Alguien puede decirme por qué mi dirección de servidor (host) es :: y no 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);
});
Esto devuelve
Example app listening at http://:::3000
Funciona bien cuando voy a http://localhost:3000/
Respuestas
5 para la respuesta № 1Porque :: es localhost cuando se usa IPv6, al igual que 127.0.0.1 en IPv4.