使用git bash 代替cmd

上一文章,用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
');
}).listen(1337, "127.0.0.1");

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

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

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

原文地址:https://www.cnblogs.com/tinyphp/p/4922315.html