From 8ec0da22596dbf36843cd3a4792014220d4c08c4 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Thu, 22 Oct 2020 23:02:55 +0900 Subject: [PATCH] fix(learn): update the required package name (#40056) --- .../advanced-node-and-express/set-up-the-environment.md | 4 ++-- .../advanced-node-and-express/set-up-the-environment.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md index 2b46479d19..ba91aac766 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md @@ -11,7 +11,7 @@ title: 设置环境 在接下来的挑战中,我们将会用到 chat.pug 文件。首先,你需要在你的 routes.js 文件中为 /chat 添加一个处理 GET 请求的路由,并给它传入 ensureAuthenticated。在回调函数中,我们需要让它 render chat.pug 文件,并在响应中包含 { user: req.user } 信息。现在,请修改 /auth/github/callback 路由,让它可以像这样设置 user_id:req.session.user_id = req.user.id,并在设置完成后重定向至 /chat。 -我们还需要添加 htmlsocket.io 两个依赖项,并且像这样引入: +我们还需要添加 httpsocket.io 两个依赖项,并且像这样引入: ```javascript const http = require('http').createServer(app); @@ -62,7 +62,7 @@ tests: - text: 应添加 Socket.IO 作为依赖。 testString: getUserInput => $.get(getUserInput('url')+ '/_api/package.json') .then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, 'socket.io', 'Your project should list "socket.io" as a dependency'); }, xhr => { throw new Error(xhr.statusText); }) - text: 应正确引入 http,并示例化为 http。 - testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /http.*=.*require.*('|")http\1/gi, 'Your project should list "html" as a dependency'); }, xhr => { throw new Error(xhr.statusText); }) + testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /http.*=.*require.*('|")http\1/gi, 'Your project should list "http" as a dependency'); }, xhr => { throw new Error(xhr.statusText); }) - text: 应正确引入 socket.io,并示例化为 io。 testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /io.*=.*require.*('|")socket.io\1.*http/gi, 'You should correctly require and instantiate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); }) - text: Socket.IO 应监听连接。 diff --git a/curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md b/curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md index ba0d823c6a..c3a6b7a6e7 100644 --- a/curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md +++ b/curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md @@ -11,7 +11,7 @@ forumTopicId: 301566 The following challenges will make use of the chat.pug file. So, in your routes.js file, add a GET route pointing to /chat which makes use of ensureAuthenticated, and renders chat.pug, with { user: req.user } passed as an argument to the response. Now, alter your existing /auth/github/callback route to set the req.session.user_id = req.user.id, and redirect to /chat. -Add html and socket.io as a dependency and require/instantiate them in your server defined as follows: +Add http and socket.io as a dependency and require/instantiate them in your server defined as follows: ```javascript const http = require('http').createServer(app); @@ -62,7 +62,7 @@ tests: - text: socket.io should be a dependency. testString: getUserInput => $.get(getUserInput('url')+ '/_api/package.json') .then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, 'socket.io', 'Your project should list "socket.io" as a dependency'); }, xhr => { throw new Error(xhr.statusText); }) - text: You should correctly require and instantiate http as http. - testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /http.*=.*require.*('|")http\1/gi, 'Your project should list "html" as a dependency'); }, xhr => { throw new Error(xhr.statusText); }) + testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /http.*=.*require.*('|")http\1/gi, 'Your project should list "http" as a dependency'); }, xhr => { throw new Error(xhr.statusText); }) - text: You should correctly require and instantiate socket.io as io. testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /io.*=.*require.*('|")socket.io\1.*http/gi, 'You should correctly require and instantiate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); }) - text: Socket.IO should be listening for connections.