diff --git a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.chinese.md b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.chinese.md index 7f02b4a71c..1c5f2f867f 100644 --- a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.chinese.md +++ b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.chinese.md @@ -1,17 +1,22 @@ --- id: 5a8b073d06fa14fcfde687aa title: Exercise Tracker -localeTitle: 运动追踪器 challengeType: 4 +isHidden: false isRequired: true +forumTopicId: 301505 +localeTitle: 运动跟踪器 --- ## Description -
构建一个功能类似于此的完整堆栈JavaScript应用程序: https://nonstop-pond.glitch.me/。在这个项目上工作将涉及您在我们的入门项目上的Glitch上编写代码。完成此项目后,您可以将公共故障网址(到应用程序的主页)复制到此屏幕进行测试!您可以选择在另一个平台上编写项目,但必须公开显示我们的测试。使用此链接在Glitch上启动此项目或在GitHub上克隆此存储库!如果您使用Glitch,请记住将项目链接保存到安全的地方! +
+构建一个功能类似于 https://fuschia-custard.glitch.me/ 的 JavaScript 全栈应用。 +在开发这个项目时,我们推荐你在 Glitch 上编码。编码完成之后,你可以把应用主页的链接复制到屏幕的输入框中,测试你的代码是否能通过项目需求。当然你也可以基于其他的平台来完成自己的项目,只要提供一个公开的主页便于我们测试就行。 +参考示例:你可以通过 这个链接 访问在 Glitch 上的项目,或者从 GitHub 上 clone 这个仓库的代码。如果你使用 Glitch,请记住将项目链接保存到妥当的地方。
## Instructions -
+
@@ -20,16 +25,179 @@ isRequired: true ```yml tests: - - text: 我可以通过将表单数据用户名发布到 /api/exercise/new-user 来创建用户,并返回将是具有用户名和_id的对象。 - testString: '' - - text: 我可以通过使用与创建用户时相同的信息获取 api/exercise/users 来获得所有用户的数组。 - testString: '' - - text: '我可以通过将表单数据userId(_id),描述,持续时间和可选日期发布到 /api/exercise/add 来向任何用户添加练习。如果没有提供日期,它将使用当前日期。应用程序将返回添加了练习字段的用户对象。' - testString: '' - - text: 我可以通过使用userId(_id)参数获取 /api/exercise/log 来检索任何用户的完整练习日志。应用程序将返回添加了数组日志和计数(总运动计数)的用户对象。 - testString: '' - - text: '我还可以通过传递from和to或limit的可选参数来检索任何用户的部分日志。(日期格式yyyy-mm-dd,limit = int)' - testString: '' + - text: 提供独立的项目, 而不是例程 url. + testString: "getUserInput => { + const url = getUserInput('url'); + assert(!(new RegExp('.*/fuschia-custard\\.glitch\\.me\\.*')).test(getUserInput('url'))); + } + " + + - text: 通过指定 `/api/exercise/new-user` 的 username 参数来创建用户, 并且返回一个具有 username 和 _id 的对象。 + testString: "async getUserInput => { + const url = getUserInput('url'); + const res = await fetch(url + '/api/exercise/new-user', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `username=fcc_test_${Date.now()}`.substr(0, 29) + }); + + if (res.ok) { + const { _id, username } = await res.json(); + assert.exists(_id); + assert.exists(username); + } else { + throw new Error(`${res.status} ${res.statusText}`); + } + } + " + - text: 通过指定 `api/exercise/users` 的参数为创建用户时相同的信息,来获取到一个用户的数组。 + testString: "async getUserInput => { + const url = getUserInput('url'); + const res = await fetch(url + '/api/exercise/users'); + + if (res.ok) { + const data = await res.json(); + assert.isArray(data); + } else { + throw new Error(`${res.status} ${res.statusText}`); + } + } + " + - text: 通过指定 `/api/exercise/add` 的 userId、description、duration 和 date(可选)参数, 去添加一条练习记录。 当没有传入 date 的时候,默认采用当前日期。 应用程序将返回添加了练习字段的用户对象。 + testString: "async getUserInput => { + const url = getUserInput('url'); + const res = await fetch(url + '/api/exercise/new-user', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `username=fcc_test_${Date.now()}`.substr(0, 29) + }); + + if (res.ok) { + const { _id, username } = await res.json(); + const expected = { + username, + description: 'test', + duration: 60, + _id, + date: 'Mon Jan 01 1990' + }; + + const addRes = await fetch(url + '/api/exercise/add', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-01` + }); + if (addRes.ok) { + const actual = await addRes.json(); + assert.deepEqual(actual, expected); + } else { + throw new Error(`${addRes.status} ${addRes.statusText}`); + } + } else { + throw new Error(`${res.status} ${res.statusText}`); + } + } + " + - text: 通过指定 `/api/exercise/log` 的 userId 参数,可以获取任意用户的练习日志和总的练习次数。 + testString: "async getUserInput => { + const url = getUserInput('url'); + const res = await fetch(url + '/api/exercise/new-user', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `username=fcc_test_${Date.now()}`.substr(0, 29) + }); + + if (res.ok) { + const { _id, username } = await res.json(); + const expected = { + username, + description: 'test', + duration: 60, + _id, + date: new Date().toDateString() + }; + + const addRes = await fetch(url + '/api/exercise/add', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}` + }); + if (addRes.ok) { + const logRes = await fetch(url + `/api/exercise/log?userId=${_id}`); + if (logRes.ok) { + const { log } = await logRes.json(); + assert.isArray(log); + assert.equal(1, log.length); + } else { + throw new Error(`${logRes.status} ${logRes.statusText}`); + } + } else { + throw new Error(`${addRes.status} ${addRes.statusText}`); + } + } else { + throw new Error(`${res.status} ${res.statusText}`); + } + } + " + - text: 我还可以通过传递可选参数 from & to 或 limit 来检索任何用户的部分日志。(日期格式如: yyyy-mm-dd, limit = int) + testString: "async getUserInput => { + const url = getUserInput('url'); + const res = await fetch(url + '/api/exercise/new-user', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `username=fcc_test_${Date.now()}`.substr(0, 29) + }); + + if (res.ok) { + const { _id, username } = await res.json(); + const expected = { + username, + description: 'test', + duration: 60, + _id, + date: new Date().toDateString() + }; + + const addExerciseRes = await fetch(url + '/api/exercise/add', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-01` + }); + const addExerciseTwoRes = await fetch(url + '/api/exercise/add', { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-02` + }); + if (addExerciseRes.ok && addExerciseTwoRes.ok) { + const logRes = await fetch( + url + `/api/exercise/log?userId=${_id}&from=1989-12-31&to=1990-01-03` + ); + if (logRes.ok) { + const { log } = await logRes.json(); + assert.isArray(log); + assert.equal(2, log.length); + } else { + throw new Error(`${logRes.status} ${logRes.statusText}`); + } + + const limitRes = await fetch( + url + `/api/exercise/log?userId=${_id}&limit=1` + ); + if (limitRes.ok) { + const { log } = await limitRes.json(); + assert.isArray(log); + assert.equal(1, log.length); + } else { + throw new Error(`${limitRes.status} ${limitRes.statusText}`); + } + } else { + throw new Error(`${res.status} ${res.statusText}`); + } + } else { + throw new Error(`${res.status} ${res.statusText}`); + } + } + " ``` @@ -44,7 +212,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.chinese.md b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.chinese.md index 3809fe587b..facdf827df 100644 --- a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.chinese.md +++ b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.chinese.md @@ -1,17 +1,22 @@ --- id: bd7158d8c443edefaeb5bd0f title: File Metadata Microservice -localeTitle: 文件元数据微服务 challengeType: 4 +isHidden: false isRequired: true +forumTopicId: 301506 +localeTitle: 文件元数据 --- ## Description -
构建一个功能类似于此的完整堆栈JavaScript应用程序: https://purple-paladin.glitch.me/ 。 在这个项目上工作将涉及您在我们的入门项目上的Glitch上编写代码。完成此项目后,您可以将公共故障网址(到应用程序的主页)复制到此屏幕进行测试!您可以选择在另一个平台上编写项目,但必须公开显示我们的测试。 使用此链接在Glitch上启动此项目或在GitHub上克隆此存储库 !如果您使用Glitch,请记住将项目链接保存到安全的地方! +
+构建一个功能类似于 https://purple-paladin.glitch.me/ 的 JavaScript 全栈应用。 +在开发这个项目时,我们推荐你在 Glitch 上编码。编码完成之后,你可以把应用主页的链接复制到屏幕的输入框中,测试你的代码是否能通过项目需求。当然你也可以基于其他的平台来完成自己的项目,只要提供一个公开的主页便于我们测试就行。 +参考示例:你可以通过 这个链接 访问在 Glitch 上的项目,或者从 GitHub 上 clone 这个仓库的代码。如果你使用 Glitch,请记住将项目链接保存到妥当的地方。
## Instructions -
+
@@ -20,9 +25,9 @@ isRequired: true ```yml tests: - - text: 我可以提交包含文件上传的FormData对象。 + - text: 我可以提交包含文件上传的 FormData 对象。 testString: '' - - text: “当我提交某些内容时,我将在JSON响应中收到以字节为单位的文件大小。” + - text: 当我提交某些内容时,我将在 JSON 响应中收到以 bytes(字节)为单位的文件大小。 testString: '' ``` @@ -38,7 +43,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.chinese.md b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.chinese.md index 6d7144ba7a..4efe911955 100644 --- a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.chinese.md +++ b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.chinese.md @@ -1,17 +1,22 @@ --- id: bd7158d8c443edefaeb5bdff title: Request Header Parser Microservice -localeTitle: 请求Header Parser Microservice challengeType: 4 +isHidden: false isRequired: true +forumTopicId: 301507 +localeTitle: 请求头解析器 --- ## Description -
构建一个功能类似于此的完整堆栈JavaScript应用程序: https://dandelion-roar.glitch.me/ 。 在这个项目上工作将涉及您在我们的入门项目上的Glitch上编写代码。完成此项目后,您可以将公共故障网址(到应用程序的主页)复制到此屏幕进行测试!您可以选择在另一个平台上编写项目,但必须公开显示我们的测试。 使用此链接在Glitch上启动此项目或在GitHub上克隆此存储库 !如果您使用Glitch,请记住将项目链接保存到安全的地方! +
+构建一个功能类似于 https://dandelion-roar.glitch.me/ 的 JavaScript 全栈应用。 +在开发这个项目时,我们推荐你在 Glitch 上编码。编码完成之后,你可以把应用主页的链接复制到屏幕的输入框中,测试你的代码是否能通过项目需求。当然你也可以基于其他的平台来完成自己的项目,只要提供一个公开的主页便于我们测试就行。 +参考示例:你可以通过 这个链接 访问在 Glitch 上的项目,或者从 GitHub 上 clone 这个仓库的代码。如果你使用 Glitch,请记住将项目链接保存到妥当的地方。
## Instructions -
+
@@ -20,9 +25,13 @@ isRequired: true ```yml tests: - - text: “我可以为我的浏览器获取IP地址,语言和操作系统。” - testString: '' - + - text: 我可以获得浏览器的IP地址、语言和操作系统信息。 + testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/whoami'').then(data => assert(data.ipaddress && data.ipaddress.length > 0), xhr => { throw new Error(xhr.responseText)})' + - text: '首选语言应该在 language 键里返回。' + testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/whoami'').then(data => assert(data.language && data.language.length > 0), xhr => { throw new Error(xhr.responseText)})' + - text: 'software 应该在 software 键里返回。' + testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/whoami'').then(data => assert(data.software && data.software.length > 0), xhr => { throw new Error(xhr.responseText)})' + ```
@@ -36,7 +45,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.chinese.md b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.chinese.md index 9f80acfa3f..95008619c0 100644 --- a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.chinese.md +++ b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.chinese.md @@ -1,17 +1,22 @@ --- id: bd7158d8c443edefaeb5bdef title: Timestamp Microservice -localeTitle: 时间戳微服务 challengeType: 4 +isHidden: false isRequired: true +forumTopicId: 301508 +localeTitle: 时间戳 --- ## Description -
构建一个功能类似于此的完整堆栈JavaScript应用程序: https://curse-arrow.glitch.me/ 。 在这个项目上工作将涉及您在我们的入门项目上的Glitch上编写代码。完成此项目后,您可以将公共故障网址(到应用程序的主页)复制到此屏幕进行测试!您可以选择在另一个平台上编写项目,但必须公开显示我们的测试。 使用此链接在Glitch上启动此项目或在GitHub上克隆此存储库 !如果您使用Glitch,请记住将项目链接保存到安全的地方! +
+构建一个功能类似于 https://curse-arrow.glitch.me/ 的 JavaScript 全栈应用。 +在开发这个项目时,我们推荐你在 Glitch 上编码。编码完成之后,你可以把应用主页的链接复制到屏幕的输入框中,测试你的代码是否能通过项目需求。当然你也可以基于其他的平台来完成自己的项目,只要提供一个公开的主页便于我们测试就行。 +参考示例:你可以通过 这个链接 访问在 Glitch 上的项目,或者从 GitHub 上 clone 这个仓库的代码。如果你使用 Glitch,请记住将项目链接保存到妥当的地方。
## Instructions -
+
@@ -20,17 +25,17 @@ isRequired: true ```yml tests: - - text: '它应该处理一个有效的日期,并返回正确的unix时间戳' + - text: 当处理一个有效的日期,返回正确的 unix 时间戳。 testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp/2016-12-25'').then(data => { assert.equal(data.unix, 1482624000000, ''Should be a valid unix timestamp''); }, xhr => { throw new Error(xhr.responseText); })' - - text: '它应该处理一个有效的日期,并返回正确的UTC字符串' + - text: 当处理一个有效的日期, 返回正确的 UTC 字符串。 testString: 'getUserInput => $.get(getUserInput(''url'')+ ''/api/timestamp/2016-12-25'').then(data => { assert.equal(data.utc, ''Sun, 25 Dec 2016 00:00:00 GMT'', ''Should be a valid UTC date string''); }, xhr => { throw new Error(xhr.responseText); })' - - text: '它应该处理一个有效的unix日期,并返回正确的unix时间戳' + - text: 当处理一个有效的 unix 格式的日期, 返回正确的 unix 时间戳。 testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp/1482624000000'').then(data => { assert.equal(data.unix, 1482624000000) ; }, xhr => { throw new Error(xhr.responseText); })' - - text: 它应返回无效日期的预期错误消息 + - text: 这个程序应该返回无效日期的预期错误消息 testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp/this-is-not-a-date'').then(data => { assert.equal(data.error.toLowerCase(), ''invalid date'');}, xhr => { throw new Error(xhr.responseText); })' - - text: '它应该处理一个空的日期参数,并以unix格式返回当前时间' + - text: 当处理一个空的日期参数的时候,返回当前时间的 unix 格式。 testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp'').then(data => { var now = Date.now(); assert.approximately(data.unix, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); })' - - text: '它应该处理一个空日期参数,并以UTC格式返回当前时间' + - text: 当处理一个空的日期参数的时候,返回当前时间的 UTC 格式。 testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp'').then(data => { var now = Date.now(); var serverTime = (new Date(data.utc)).getTime(); assert.approximately(serverTime, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); })' ``` @@ -46,7 +51,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +
diff --git a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.chinese.md b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.chinese.md index 00fac44944..c2a5a1f350 100644 --- a/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.chinese.md +++ b/curriculum/challenges/chinese/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.chinese.md @@ -1,17 +1,22 @@ --- id: bd7158d8c443edefaeb5bd0e title: URL Shortener Microservice -localeTitle: URL Shortener微服务 challengeType: 4 +isHidden: false isRequired: true +forumTopicId: 301509 +localeTitle: 短网址 --- ## Description -
构建一个功能类似于此的完整堆栈JavaScript应用程序: https://thread-paper.glitch.me/ 。在这个项目上工作将涉及您在我们的入门项目上的Glitch上编写代码。完成此项目后,您可以将公共故障网址(到应用程序的主页)复制到此屏幕进行测试!您可以选择在另一个平台上编写项目,但必须公开显示我们的测试。使用此链接在Glitch上启动此项目或在GitHub上克隆此存储库 !如果您使用Glitch,请记住将项目链接保存到安全的地方! +
+构建一个功能类似于 https://thread-paper.glitch.me/ 的 JavaScript 全栈应用。 +在开发这个项目时,我们推荐你在 Glitch 上编码。编码完成之后,你可以把应用主页的链接复制到屏幕的输入框中,测试你的代码是否能通过项目需求。当然你也可以基于其他的平台来完成自己的项目,只要提供一个公开的主页便于我们测试就行。 +参考示例:你可以通过 这个链接 访问在 Glitch 上的项目,或者从 GitHub 上 clone 这个仓库的代码。如果你使用 Glitch,请记住将项目链接保存到妥当的地方。
## Instructions -
+
@@ -20,11 +25,11 @@ isRequired: true ```yml tests: - - text: 我可以传递一个URL作为参数,我将在JSON响应中收到一个缩短的URL。 + - text: 当我传入一个 url 作为参数时,我将在JSON响应中收到缩短的URL。 testString: '' - - text: '如果我传递的网址无效,并且不遵循有效的http://www.example.com格式,则JSON响应将包含错误。' + - text: '如果我传入一个无效的链接,则会返回一个包含 “没有遵循如 http://www.example.com 的有效格式” 的错误信息的 JSON 响应。' testString: '' - - text: “当我访问缩短的网址时,它会将我重定向到我原来的链接。” + - text: 当我访问这个短 URL 时, 将重定向到我原来的链接。 testString: '' ``` @@ -32,7 +37,7 @@ tests:
## Challenge Seed -
+
@@ -40,7 +45,11 @@ tests:
```js -// solution required +/** + Backend challenges don't need solutions, + because they would need to be tested against a full working project. + Please check our contributing guidelines to learn more. +*/ ``` -/section> +