为了账号安全,请及时绑定邮箱和手机立即绑定

为什么启动后,在页面出不来hello world呢

为什么启动后,在页面出不来hello world呢

正在回答

1 回答

地址输入错误。

const http = require('http');


const hostname = '127.0.0.1';

const port = 3000;


const server = http.createServer((req, res) => {

  res.statusCode = 200;

  res.setHeader('Content-Type', 'text/plain');

  res.end('Hello World\n');

});


server.listen(port, hostname, () => {

  console.log(`Server running at http://${hostname}:${port}/`);

});


0 回复 有任何疑惑可以回复我~
#1

慕粉0750002327 提问者

非常感谢!
2017-04-17 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
进击Node.js基础(一)
  • 参与学习       219315    人
  • 解答问题       982    个

本视频教程带你揭开Node.js的面纱,带你走进一个全新世界

进入课程

为什么启动后,在页面出不来hello world呢

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号