上一文章,用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_php

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

使用git bash 代替cmd_bash_02

 

使用git bash 代替cmd_github_03