任何人都可以告诉我为什么我的服务器地址(主机)是::而不是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/时工作正常
解决方法
因为::在使用IPv6时是localhost,就像IPv4中的127.0.0.1一样.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。