搭建AngualarJS开发环境

jopen 8年前

1.选择Web浏览器

Chrome和Firefox浏览器

2.选择代码编辑器

Subline Text和Visual Studio Code

3.安装Web服务器

3.1Apache HTTP Server

官方网站: https://httpd.apache.org/ 说明Httpd和Tomcat都是出自Apache基金会的,但是是2个不同的东西。

因为从新版本开始,Apache官方网站不提供.exe的安装程序给到windows用户,所以需要到 http://httpd.apache.org/docs/current/platform/windows.html#down 找到下载地址,下载完成之后也不知之前的exe安装文件,不过在bin文件夹中可以找到httpd.exe。如下图所示:

3.2安装Node.js加载connect模块启动一个简单的web服务器

connect模块安装路径:C:\Users\Administrator\AppData\Roaming\npm\node_modules\connect

运行node server.js出现如下错误:

问题:原因是书上作者的connect模块的版本比较低。同时要引入serve-static模块,我没有升

级connect模块,只是直接安装npm install serve-static。

参考地址: http://stackoverflow.com/questions/24346161/nodejs-connect-cannot-find-static

server.js代码修改如下:

var connect=require('connect');  var serverStatic=require('serve-static');    var app=connect();  app.use(serverStatic("../angularjs"));  app.listen(5000);

4 运行结果

我在angularjs文件夹中新建了一个index.html,然后写了一个hello world。运行成功结果如图:

github地址: https://github.com/liminjun/liminjun.github.io/issues/12

segemtfault地址: https://segmentfault.com/a/1190000004334860

</div>

来自: http://www.cnblogs.com/liminjun88/p/5144164.html