小编Dav*_*010的帖子

Express.js-为什么是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);
});
Run Code Online (Sandbox Code Playgroud)

这回来了

Example app listening at http://:::3000
Run Code Online (Sandbox Code Playgroud)

当我去http:// localhost:3000 /时,它工作正常

localhost node.js express

7
推荐指数
1
解决办法
1308
查看次数

标签 统计

express ×1

localhost ×1

node.js ×1