Skip to content

Commit

Permalink
对课程内容进行分类
Browse files Browse the repository at this point in the history
对课程内容进行分类, 将其分为两类. 针对 PHP 增加讲解, 方便 PHP 开发者知识迁移.
  • Loading branch information
iugo committed Jun 24, 2015
1 parent d981218 commit cfe999d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lesson1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@

## 知识点

1. 学习使用 npm 安装依赖
2. 学习新建 express 实例,并定义 routes ,产生输出。
1. 包管理器 npm 。使用 npm 安装包,并自动安装所需依赖。
2. 框架 express 。学习新建 express 实例,并定义 routes ,产生输出。

## 课程内容

按照惯例,我们来个 helloworld 入门。

### 包管理器 npm

npm 可以自动管理包的依赖. 只需要安装你想要的包, 不必考虑这个包的依赖包.

在 PHP 中, 包管理使用的 `Composer`, python 中,包管理使用 `easy_install` 或者 `pip`,ruby 中我们使用 `gem`。而在 Node.js 中,对应就是 `npm`,npm 是 `Node.js Package Manager` 的意思。

### 框架 Express

express 是 Node.js 应用最广泛的 web 框架,现在是 4.x 版本,它非常薄。跟 Rails 比起来,完全两个极端。

express 的官网是 http://expressjs.com/ ,我常常上去看它的 API。

首先我们需要得到一个 express。

从 php 和 python 来的同学可能对于“包依赖管理”的概念不是太熟悉,ruby 来的同学应该就熟悉多了。

在 python 中,包管理使用 `easy_install` 或者 `pip`,ruby 中我们使用 `gem`。而在 Node.js 中,对应就是 `npm`,npm 是 `Node.js Package Manager` 的意思。

不同于 ruby 的 gem 装在全局,Node.js 的依赖是以项目为单位管理的,直接就安装在项目的 `node_modules` 目录下,而且每个依赖都可以有指定版本的其他依赖,这些依赖像一棵树一样。根据我自己的使用经验来说,npm 的体验在 pip 和 gem 之上。

OK,新建一个文件夹叫 lesson1 的,进去里面安装 express
Expand Down

0 comments on commit cfe999d

Please sign in to comment.