上一文章,用Node.js建HTTP服务器,然后在cmd启动,这次尝试用git bash。

git bash 也是命令行工具,画面更好看,使用更方便,可以替代cmd。

下载git:https://git-for-windows.github.io/

安装省略....

 

 第一步:打开Git Bash,输入代码,获取实例文件:

git clone git://github.com/angular/angular-phonecat.git

 

第二步:启动

npm start

 

第三步,F盘创建tinyphp.js

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, "127.0.0.1");

console.log('Server running at http://127.0.0.1:1337/');
复制代码

第四步:在F盘下运行node tinyphp.js

使用git bash 代替cmd

然后打开浏览器访问: http://127.0.0.1:1337

使用git bash 代替cmd

 

相关文章:

  • 2021-11-06
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-10-14
  • 2021-11-04
猜你喜欢
  • 2021-07-07
  • 2021-10-06
  • 2021-12-25
  • 2021-07-06
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
相关资源
相似解决方案