From de72bb13f500db04b31f25aac8fb2d0760696095 Mon Sep 17 00:00:00 2001 From: alsotang Date: Tue, 20 Oct 2015 11:21:39 +0800 Subject: [PATCH 01/26] Update README.md --- lesson12/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson12/README.md b/lesson12/README.md index 18bdd0b..6f23259 100644 --- a/lesson12/README.md +++ b/lesson12/README.md @@ -2,7 +2,7 @@ ## 目标 -将 https://github.com/Ricardo-Li/node-practice-2 这个项目部署上 heroku,成为一个线上项目 +将 https://github.com/Ricardo-Li/node-practice-2 (这个项目已经被删了。参照 https://github.com/alsotang/node-lessons/tree/master/lesson3 的代码自己操作一下吧。)这个项目部署上 heroku,成为一个线上项目 我部署的在这里 http://serene-falls-9294.herokuapp.com/ From ac4fe023875f71f7be64dba440d82f891a75259c Mon Sep 17 00:00:00 2001 From: huguangju Date: Mon, 16 Nov 2015 13:21:50 +0800 Subject: [PATCH 02/26] fixed mocha-phantomjs 'SSL handshake failed' --- lesson7/README.md | 14 ++++++++------ lesson7/vendor/index.html | 12 +++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lesson7/README.md b/lesson7/README.md index 12b64b3..b9fd912 100644 --- a/lesson7/README.md +++ b/lesson7/README.md @@ -102,18 +102,20 @@ npm i -g mocha-phantomjs ```html ``` 这时候, 我们在命令行中运行 ```shell -mocha-phantomjs index.html +mocha-phantomjs index.html --ssl-protocol=any --ignore-ssl-errors=true ``` 结果展现是不是和后端代码测试很类似 :smile: @@ -123,7 +125,7 @@ mocha-phantomjs index.html ```json "scripts": { - "test": "mocha-phantomjs index.html" + "test": "mocha-phantomjs index.html --ssl-protocol=any --ignore-ssl-errors=true" }, ``` diff --git a/lesson7/vendor/index.html b/lesson7/vendor/index.html index 738537d..f3bb045 100644 --- a/lesson7/vendor/index.html +++ b/lesson7/vendor/index.html @@ -8,7 +8,7 @@
- + From 2f61700dc411890d0cb24b3171f49d1026584895 Mon Sep 17 00:00:00 2001 From: alsotang Date: Wed, 13 Jan 2016 11:57:24 +0800 Subject: [PATCH 03/26] Update README.md --- lesson11/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson11/README.md b/lesson11/README.md index 9375a9f..c0c53f4 100644 --- a/lesson11/README.md +++ b/lesson11/README.md @@ -115,7 +115,7 @@ for (var i = 0; i < 5; i++) { } ``` -上面这个代码块会打印五个 `5` 出来,而我们预想的结果是打印 1 2 3 4 5。 +上面这个代码块会打印五个 `5` 出来,而我们预想的结果是打印 0 1 2 3 4。 之所以会这样,是因为 setTimeout 中的 i 是对外层 i 的引用。当 setTimeout 的代码被解释的时候,运行时只是记录了 i 的引用,而不是值。而当 setTimeout 被触发时,五个 setTimeout 中的 i 同时被取值,由于它们都指向了外层的同一个 i,而那个 i 的值在迭代完成时为 5,所以打印了五次 `5`。 From 6515cabb78732cc6b9e4b95f42b53fe6f40d3c53 Mon Sep 17 00:00:00 2001 From: alsotang Date: Thu, 31 Mar 2016 21:35:57 +0800 Subject: [PATCH 04/26] Update README.md --- lesson17/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson17/README.md b/lesson17/README.md index 7e52531..7f48825 100644 --- a/lesson17/README.md +++ b/lesson17/README.md @@ -141,7 +141,7 @@ var outputPromise = getInputPromise().then(function(fulfilled){ /** * 当outputPromise状态由未完成变成fulfil时,调用function(fulfilled),控制台打印'fulfilled: fulfilled'。 - * 当outputPromise状态由未完成变成rejected, 调用function(rejected), 控制台打印'fulfilled: rejected'。 + * 当outputPromise状态由未完成变成rejected, 调用function(rejected), 控制台打印'rejected: rejected'。 */ outputPromise.then(function(fulfilled){ console.log('fulfilled: ' + fulfilled); From 08d3b5f33ebcdb580136f93d01cf730eafd550ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AD=96?= <634692517@qq.com> Date: Wed, 6 Apr 2016 20:20:31 +0800 Subject: [PATCH 05/26] Update README.md --- lesson10/README.md | 6 ++++-- lesson10/main.js | 2 +- lesson10/package.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lesson10/README.md b/lesson10/README.md index 7d788f8..e60248b 100644 --- a/lesson10/README.md +++ b/lesson10/README.md @@ -17,7 +17,9 @@ 首先去弄个 benchmark 库,https://github.com/bestiejs/benchmark.js 。 -这个库已经两年没有更新了,两年前发了个 1.0.0 版本,直到现在。 + 这个库已经两年没有更新了,两年前发了个 1.0.0 版本,直到现在。 + +这个库的最新版本是 2.1.0 用法也特别简单,照着官网的 copy 下来就好。 @@ -58,7 +60,7 @@ suite console.log(String(event.target)); }) .on('complete', function() { - console.log('Fastest is ' + this.filter('fastest').pluck('name')); + console.log('Fastest is ' + this.filter('fastest').map('name')); }) // 这里的 async 不是 mocha 测试那个 async 的意思,这个选项与它的时间计算有关,默认勾上就好了。 .run({ 'async': true }); diff --git a/lesson10/main.js b/lesson10/main.js index 0b41ae2..223b90b 100644 --- a/lesson10/main.js +++ b/lesson10/main.js @@ -32,7 +32,7 @@ suite console.log(String(event.target)); }) .on('complete', function() { - console.log('Fastest is ' + this.filter('fastest').pluck('name')); + console.log('Fastest is ' + this.filter('fastest').map('name')); }) // run async .run({ 'async': true }); diff --git a/lesson10/package.json b/lesson10/package.json index a2ace76..26977da 100644 --- a/lesson10/package.json +++ b/lesson10/package.json @@ -9,6 +9,6 @@ "author": "alsotang ", "license": "MIT", "dependencies": { - "benchmark": "^1.0.0" + "benchmark": "^2.1.0" } } From fa14f95ae01cf8c026742b220dfcbbe16bdc372d Mon Sep 17 00:00:00 2001 From: alsotang Date: Fri, 15 Apr 2016 11:15:35 +0800 Subject: [PATCH 06/26] Update README.md typo --- lesson8/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lesson8/README.md b/lesson8/README.md index 8ec2d31..b6a94fe 100644 --- a/lesson8/README.md +++ b/lesson8/README.md @@ -239,12 +239,12 @@ describe('test/app.test.js', function () { var supertest = require('supertest'); var userCookie; supertest.post('login').end(function (err, res) { - userCookie = res.headers['Cookie'] + userCookie = res.headers['set-cookie'] }); // then .. supertest.post('create_topic') - .set('Cookie', userCookie) + .set('cookie', userCookie) .end(...) ``` From 55954a48d1d8bb8791abd5584a972811d1923a87 Mon Sep 17 00:00:00 2001 From: alsotang Date: Wed, 27 Apr 2016 13:20:43 +0800 Subject: [PATCH 07/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e58272..387ca48 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ 更多 Node.js 入门资料请前往:https://cnodejs.org/getstart -新手搭建 Node.js 云主机,推荐使用无需备案的 [Linode(https://www.linode.com)](https://www.linode.com/?r=15ca84df052ab2ac2cc4ac21714969900782a827) 或 [DigitalOcean(https://www.digitalocean.com/)](https://www.digitalocean.com/?refcode=eba02656eeb3) +新手搭建 Node.js 云主机,推荐使用无需备案的 [DigitalOcean(https://www.digitalocean.com/)](https://www.digitalocean.com/?refcode=eba02656eeb3) ## 课程列表 From 99f168cc45a9dad7f86ba67730ad6c095262d612 Mon Sep 17 00:00:00 2001 From: alsotang Date: Wed, 6 Jul 2016 20:05:49 +0800 Subject: [PATCH 08/26] Update README.md --- lesson4/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lesson4/README.md b/lesson4/README.md index 2429aa6..517a8aa 100644 --- a/lesson4/README.md +++ b/lesson4/README.md @@ -49,6 +49,8 @@ ## 课程内容 +*注意,cnodejs.org 网站有并发连接数的限制,所以当请求发送太快的时候会导致返回值为空或报错。建议一次抓取3个主题即可。文中的40只是为了方便讲解* + 这一章我们来到了 Node.js 最牛逼的地方——异步并发的内容了。 上一课我们介绍了如何使用 superagent 和 cheerio 来取主页内容,那只需要发起一次 http get 请求就能办到。但这次,我们需要取出每个主题的第一条评论,这就要求我们对每个主题的链接发起请求,并用 cheerio 去取出其中的第一条评论。 From 74ace7dc263ee904863c0a92c862f4f1bba32d53 Mon Sep 17 00:00:00 2001 From: alsotang Date: Fri, 8 Jul 2016 15:22:35 +0800 Subject: [PATCH 09/26] Update README.md --- lesson7/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson7/README.md b/lesson7/README.md index b9fd912..7423415 100644 --- a/lesson7/README.md +++ b/lesson7/README.md @@ -53,7 +53,7 @@ mocha就会自动帮我们生成一个简单的测试原型, 目录结构如下 ```html
- +