0
点赞
收藏
分享

微信扫一扫

标题 node第一个服务器程序

北冥有一鲲 2022-08-03 阅读 83
编程语言


 

1.2    正文

1.    新建一个example.js文件

代码如下:

var http=require('http');
http.createServer(function(req,res){
res.writeHead(200,{'Content-Type':'text/plain'});
res.end('Hello,World\n');
}).listen(1337,'localhost');
console.log('Server running at ​​ http://localhost:1337/​​');

2.    之后在cmd下执行

3.     

 

4.    在浏览器中输入​​http://localhost:1337​​

举报

相关推荐

0 条评论