chore(i18n,curriculum): processed translations (#42115)
This commit is contained in:
@@ -11,7 +11,7 @@ dashedName: exercise-tracker
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似: <https://exercise-tracker.freecodecamp.rocks/>。 可以采用下面的一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/) 并在本地完成你的项目。
|
||||
- 使用 [repl.it 初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-exercisetracker) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker)来完成你的项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
@@ -29,12 +29,12 @@ dashedName: exercise-tracker
|
||||
};
|
||||
```
|
||||
|
||||
可以将表单里的 `username` 通过 `POST` 请求发送到 `/api/exercise/new-user`,以创建一个新的用户。 返回的响应内容是一个带有 `username` 和 `_id` 的对象
|
||||
可以将表单里的 `username` 通过 `POST` 请求发送到 `/api/users`,以创建一个新的用户。 返回的响应内容是一个带有 `username` 和 `_id` 的对象
|
||||
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const res = await fetch(url + '/api/exercise/new-user', {
|
||||
const res = await fetch(url + '/api/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
|
||||
@@ -49,12 +49,12 @@ async (getUserInput) => {
|
||||
};
|
||||
```
|
||||
|
||||
可以发送 `GET` 请求到 `api/exercise/users`,以获取一个所有用户的数组, 数组里的每个元素都是一个包含 `username` 和 `_id` 的用户对象。
|
||||
可以发送 `GET` 请求到 `/api/users`,以获取一个所有用户的数组, 数组里的每个元素都是一个包含 `username` 和 `_id` 的用户对象。
|
||||
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const res = await fetch(url + '/api/exercise/users');
|
||||
const res = await fetch(url + '/api/users');
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
assert.isArray(data);
|
||||
@@ -66,12 +66,12 @@ async (getUserInput) => {
|
||||
};
|
||||
```
|
||||
|
||||
你能用表单里的 `userId=_id`,`description`,`duration` 和 `date`(可选)发送 `POST` 请求到 `/api/exercise/add`。 如果没有传入 date,默认采用当前日期。 响应内容是包含 exercise 表单内容的 user 对象。
|
||||
你能用表单里的 `description`、`duration` 和 `date`(可选)发送 `POST` 请求到 `/api/users/:_id/exercises`。 如果没有传入 date,默认采用当前日期。 响应内容是包含 exercise 表单内容的 user 对象。
|
||||
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const res = await fetch(url + '/api/exercise/new-user', {
|
||||
const res = await fetch(url + '/api/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
|
||||
@@ -85,10 +85,10 @@ async (getUserInput) => {
|
||||
_id,
|
||||
date: 'Mon Jan 01 1990'
|
||||
};
|
||||
const addRes = await fetch(url + '/api/exercise/add', {
|
||||
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
|
||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
|
||||
});
|
||||
if (addRes.ok) {
|
||||
const actual = await addRes.json();
|
||||
@@ -102,12 +102,12 @@ async (getUserInput) => {
|
||||
};
|
||||
```
|
||||
|
||||
可以向 `/api/exercise/log` 发送参数为 `userId=_id` 的 `GET` 请求,并检索全部的 exercise 日志。 响应内容是一个 user 对象,它带有一个 `log` 属性,该属性的值是所有被添加的 exercises 表单记录组成的数组, 每一个 log 数组里的元素应该是一个含有 `description`、`duration` 和 `date` 等属性的对象。
|
||||
可以发送 `GET` 请求到 `/api/users/:_id/logs`,以获取任何用户的完整 exercise 日志。 响应内容是一个 user 对象,它带有一个 `log` 属性,该属性的值是所有被添加的 exercises 表单记录组成的数组, 每一个 log 数组里的元素应该是一个含有 `description`、`duration` 和 `date` 等属性的对象。
|
||||
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const res = await fetch(url + '/api/exercise/new-user', {
|
||||
const res = await fetch(url + '/api/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
|
||||
@@ -121,13 +121,13 @@ async (getUserInput) => {
|
||||
_id,
|
||||
date: new Date().toDateString()
|
||||
};
|
||||
const addRes = await fetch(url + '/api/exercise/add', {
|
||||
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}`
|
||||
body: `description=${expected.description}&duration=${expected.duration}`
|
||||
});
|
||||
if (addRes.ok) {
|
||||
const logRes = await fetch(url + `/api/exercise/log?userId=${_id}`);
|
||||
const logRes = await fetch(url + `/api/users/${_id}/logs`);
|
||||
if (logRes.ok) {
|
||||
const { log } = await logRes.json();
|
||||
assert.isArray(log);
|
||||
@@ -144,12 +144,12 @@ async (getUserInput) => {
|
||||
};
|
||||
```
|
||||
|
||||
用户日志请求 (`/api/exercise/log`) 返回一个带有 `count` 属性的对象,该属性反映 exercises 表单的成功提交次数(译者注:即 log 属性元素的个数)。
|
||||
用户日志请求(`/api/users/:_id/logs`)返回一个带有 `count` 属性的对象,该属性反映 exercises 表单的成功提交次数(译者注:即 log 属性元素的个数)。
|
||||
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const res = await fetch(url + '/api/exercise/new-user', {
|
||||
const res = await fetch(url + '/api/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
|
||||
@@ -163,13 +163,13 @@ async (getUserInput) => {
|
||||
_id,
|
||||
date: new Date().toDateString()
|
||||
};
|
||||
const addRes = await fetch(url + '/api/exercise/add', {
|
||||
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}`
|
||||
body: `description=${expected.description}&duration=${expected.duration}`
|
||||
});
|
||||
if (addRes.ok) {
|
||||
const logRes = await fetch(url + `/api/exercise/log?userId=${_id}`);
|
||||
const logRes = await fetch(url + `/api/users/${_id}/logs`);
|
||||
if (logRes.ok) {
|
||||
const { count } = await logRes.json();
|
||||
assert(count);
|
||||
@@ -185,12 +185,12 @@ async (getUserInput) => {
|
||||
};
|
||||
```
|
||||
|
||||
可以把 `from`、`to` 和 `limit` 等参数添加到 `/api/exercise/log` 的请求,以查询该用户的部分 exercise 表单提交记录, `from` 和 `to` 是 `yyyy-mm-dd` 形式的日期, `limit` 是希望返回的 log 数量。
|
||||
可以把 `from`、`to` 和 `limit` 参数添加到一个 `/api/users/:_id/logs` 请求,以查询该用户的部分 exercise 表单提交记录, `from` 和 `to` 是 `yyyy-mm-dd` 形式的日期, `limit` 是希望返回的 log 数量。
|
||||
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const res = await fetch(url + '/api/exercise/new-user', {
|
||||
const res = await fetch(url + '/api/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
|
||||
@@ -204,19 +204,19 @@ async (getUserInput) => {
|
||||
_id,
|
||||
date: new Date().toDateString()
|
||||
};
|
||||
const addExerciseRes = await fetch(url + '/api/exercise/add', {
|
||||
const addExerciseRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
|
||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
|
||||
});
|
||||
const addExerciseTwoRes = await fetch(url + '/api/exercise/add', {
|
||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
||||
body: `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`
|
||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
||||
);
|
||||
if (logRes.ok) {
|
||||
const { log } = await logRes.json();
|
||||
@@ -226,7 +226,7 @@ async (getUserInput) => {
|
||||
throw new Error(`${logRes.status} ${logRes.statusText}`);
|
||||
}
|
||||
const limitRes = await fetch(
|
||||
url + `/api/exercise/log?userId=${_id}&limit=1`
|
||||
url + `/api/users/${_id}/logs?limit=1`
|
||||
);
|
||||
if (limitRes.ok) {
|
||||
const { log } = await limitRes.json();
|
||||
|
@@ -11,7 +11,7 @@ dashedName: file-metadata-microservice
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://file-metadata-microservice.freecodecamp.rocks/>。 可以采用下面的一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) 并在本地完成项目。
|
||||
- 使用 [repl.it 初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-filemetadata) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata)来完成你的项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
|
@@ -11,7 +11,7 @@ dashedName: request-header-parser-microservice
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://request-header-parser-microservice.freecodecamp.rocks/>。 可以采用下面的一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-headerparser/) 并在本地完成项目。
|
||||
- 使用 [repl.it 初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-headerparser) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser)来完成你的项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
|
@@ -11,7 +11,7 @@ dashedName: timestamp-microservice
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://timestamp-microservice.freecodecamp.rocks/>。 可以采用下面的任意一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-timestamp/) 并在本地完成项目。
|
||||
- 使用 [repl.it 初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-timestamp) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp)来完成你的项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
@@ -28,11 +28,11 @@ dashedName: timestamp-microservice
|
||||
};
|
||||
```
|
||||
|
||||
向 `/api/timestamp/:date?` 发送一个带有有效日期的请求,应该很快(在几毫秒内)返回一个 JSON 对象,在这个 JSON 对象内有一个包含输入日期的 Unix 时间戳的 `unix` 键。
|
||||
向 `/api/:date?` 发送一个带有有效日期的请求,应该很快(在几毫秒内)返回一个 JSON 对象,在这个 JSON 对象内有一个包含输入日期的 Unix 时间戳的 `unix` 键。
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/api/timestamp/2016-12-25').then(
|
||||
$.get(getUserInput('url') + '/api/2016-12-25').then(
|
||||
(data) => {
|
||||
assert.equal(
|
||||
data.unix,
|
||||
@@ -46,11 +46,11 @@ dashedName: timestamp-microservice
|
||||
);
|
||||
```
|
||||
|
||||
向 `/api/timestamp/:date?` 发送一个带有有效日期的请求,应该返回一个 JSON 对象,在这个 JSON 对象内有一个包含如 `Thu, 01 Jan 1970 00:00:00 GMT` 格式的输入日期的 `utc` 键。
|
||||
向 `/api/:date?` 发送一个带有有效日期的请求,应该返回一个 JSON 对象,在这个 JSON 对象内有一个包含如 `Thu, 01 Jan 1970 00:00:00 GMT` 格式的输入日期的 `utc` 键。
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/api/timestamp/2016-12-25').then(
|
||||
$.get(getUserInput('url') + '/api/2016-12-25').then(
|
||||
(data) => {
|
||||
assert.equal(
|
||||
data.utc,
|
||||
@@ -64,11 +64,11 @@ dashedName: timestamp-microservice
|
||||
);
|
||||
```
|
||||
|
||||
向 `/api/timestamp/1451001600000` 发送请求,应该返回 `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`。
|
||||
向 `/api/1451001600000` 发送请求,应该返回 `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`。
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/api/timestamp/1451001600000').then(
|
||||
$.get(getUserInput('url') + '/api/1451001600000').then(
|
||||
(data) => {
|
||||
assert(
|
||||
data.unix === 1451001600000 &&
|
||||
@@ -85,7 +85,7 @@ dashedName: timestamp-microservice
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/api/timestamp/05 October 2011').then(
|
||||
$.get(getUserInput('url') + '/api/05 October 2011').then(
|
||||
(data) => {
|
||||
assert(
|
||||
data.unix === 1317772800000 &&
|
||||
@@ -102,7 +102,7 @@ dashedName: timestamp-microservice
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/api/timestamp/this-is-not-a-date').then(
|
||||
$.get(getUserInput('url') + '/api/this-is-not-a-date').then(
|
||||
(data) => {
|
||||
assert.equal(data.error.toLowerCase(), 'invalid date');
|
||||
},
|
||||
@@ -116,7 +116,7 @@ dashedName: timestamp-microservice
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/api/timestamp').then(
|
||||
$.get(getUserInput('url') + '/api').then(
|
||||
(data) => {
|
||||
var now = Date.now();
|
||||
assert.approximately(data.unix, now, 20000);
|
||||
@@ -131,7 +131,7 @@ dashedName: timestamp-microservice
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/api/timestamp').then(
|
||||
$.get(getUserInput('url') + '/api').then(
|
||||
(data) => {
|
||||
var now = Date.now();
|
||||
var serverTime = new Date(data.utc).getTime();
|
||||
|
@@ -11,7 +11,7 @@ dashedName: url-shortener-microservice
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://url-shortener-microservice.freecodecamp.rocks/>。 可以采用下面的任意一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) 并在本地完成项目。
|
||||
- 使用 [repl.it 初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-urlshortener) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener)来完成你的项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
@@ -34,14 +34,14 @@ dashedName: url-shortener-microservice
|
||||
};
|
||||
```
|
||||
|
||||
可以通过 POST 请求给 `/api/shorturl/new` 发送一个 URL,并返回一个带有 `original_url` 和 `short_url` 属性的 JSON 响应, 例如:`{ original_url : 'https://freeCodeCamp.org', short_url : 1}`。
|
||||
可以通过 POST 请求给 `/api/shorturl` 发送一个 URL,并返回一个带有 `original_url` 和 `short_url` 属性的 JSON 响应。 例如:`{ original_url : 'https://freeCodeCamp.org', short_url : 1}`。
|
||||
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const urlVariable = Date.now();
|
||||
const fullUrl = `${url}/?v=${urlVariable}`
|
||||
const res = await fetch(url + '/api/shorturl/new/', {
|
||||
const res = await fetch(url + '/api/shorturl', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `url=${fullUrl}`
|
||||
@@ -64,7 +64,7 @@ async (getUserInput) => {
|
||||
const urlVariable = Date.now();
|
||||
const fullUrl = `${url}/?v=${urlVariable}`
|
||||
let shortenedUrlVariable;
|
||||
const postResponse = await fetch(url + '/api/shorturl/new/', {
|
||||
const postResponse = await fetch(url + '/api/shorturl', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `url=${fullUrl}`
|
||||
@@ -93,7 +93,7 @@ async (getUserInput) => {
|
||||
```js
|
||||
async (getUserInput) => {
|
||||
const url = getUserInput('url');
|
||||
const res = await fetch(url + '/api/shorturl/new/', {
|
||||
const res = await fetch(url + '/api/shorturl', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `url=ftp:/john-doe.org`
|
||||
|
@@ -11,14 +11,14 @@ dashedName: meet-the-node-console
|
||||
可以采用下面的任意一种方式完成这些挑战:
|
||||
|
||||
- 克隆 [这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-express/) 并在本地完成项目。
|
||||
- 使用 [Repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-express) 来完成项目。
|
||||
- 使用[我们的 Repl.it 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-express)来完成项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。
|
||||
|
||||
在开发过程中,能够随时看到代码的运行结果是非常重要的。
|
||||
|
||||
Node 只是一个 JavaScript 环境。 与客户端 JavaScript 一样,你可以使用控制台显示有用的调试信息。 在本地计算机上,你可以在终端中输出调试信息。 在 Repl.it 上,右侧边栏会默认打开一个终端。
|
||||
Node 只是一个 JavaScript 环境。 与客户端 JavaScript 一样,你可以使用控制台显示有用的调试信息。 在本地计算机上,你可以在终端中输出调试信息。 在 Replit 上,右侧边栏会默认打开一个终端。
|
||||
|
||||
我们建议在做这些挑战题时保持终端打开的状态。 通过这些终端的输出,你可能会发现这些错误的本质原因。
|
||||
|
||||
|
@@ -22,7 +22,7 @@ function(req, res) {
|
||||
|
||||
# --instructions--
|
||||
|
||||
当 GET 请求 `/`(根路由 )时,使用 `app.get()` 方法响应一个“Hello Express”字符串。 通过查看日志确保代码正常运行,如果使用 Repl.it 可以在预览中查看结果。
|
||||
当 GET 请求 `/`(根路由 )时,使用 `app.get()` 方法响应一个“Hello Express”字符串。 通过查看日志确保代码正常运行,如果使用 Replit 可以在预览中查看结果。
|
||||
|
||||
**注意:** 这些课程的所有代码应该放在开始给出的几行代码之间。
|
||||
|
||||
|
@@ -16,11 +16,15 @@ dashedName: use-the--env-file
|
||||
|
||||
添加一个环境变量作为配置选项。
|
||||
|
||||
在项目根目录创建一个 `.env` 文件,并存储变量 `MESSAGE_STYLE=uppercase`。 当向 `/json` 发 GET 请求时,如果 `process.env.MESSAGE_STYLE` 的值为 `uppercase`,那么上一次挑战中的路由处理程序返回的对象的消息则应该大写, 即响应对象应该是 `{"message": "HELLO JSON"}`。
|
||||
在项目根目录创建一个 `.env` 文件,并存储变量 `MESSAGE_STYLE=uppercase`。
|
||||
|
||||
当向 `/json` 发 GET 请求时,如果 `process.env.MESSAGE_STYLE` 的值为 `uppercase`,那么上一次挑战中的路由处理程序返回的对象的消息则应该大写。 响应对象应该是 `{"message": "Hello json"}` or `{"message": "HELLO JSON"}`,取决于 `MESSAGE_STYLE` 的值。
|
||||
|
||||
**注意:**如果你正在使用 Replit,你无法创建一个 `.env` 文件。 相反,使用内置的 <dfn>SECRETS</dfn> 标签添加变量。
|
||||
|
||||
# --hints--
|
||||
|
||||
端口 `/json` 响应的值,应该随着环境变量 `MESSAGE_STYLE` 的变化而改变
|
||||
端口 `/json` 响应的值,应该随着环境变量 `MESSAGE_STYLE` 的变化而改变。
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
|
@@ -11,7 +11,7 @@ dashedName: how-to-use-package-json-the-core-of-any-node-js-project-or-npm-packa
|
||||
可以采用下面的任意一种方式完成这些挑战:
|
||||
|
||||
- 克隆 [GitHub repo](https://github.com/freeCodeCamp/boilerplate-npm/) 并在本地完成项目。
|
||||
- 使用 [Repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-npm) 来完成项目。
|
||||
- 使用[我们的 Replit 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-npm)来完成项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
|
@@ -12,7 +12,7 @@ dashedName: create-a-model
|
||||
|
||||
首先,我们需要一个 Schema, 每一个 Schema 都对应一个 MongoDB 的 collection, 并且在相应的 collection 里定义 documents 的“样子”。 Schema 用于组成模型(Model), 我们甚至可以通过嵌套 Schema 来创建复杂的模型。目前我们先从简。 我们可以根据模型创建实例,模型实例化后的对象称为 documents。
|
||||
|
||||
Repl.it 是一个真实的服务器。正式的服务通过 handler 函数和数据库交互。 这些函数会在特定事件(比如有人调用了我们的服务器 API)发生时执行。 接下来的挑战题目即是以此为基础。 `done()` 是一个回调函数,它的作用是在一个异步操作(比如对数据库进行插入、查询、更新或删除)执行完成时,通知我们可以继续执行后续的其它代码。 这与 Node.js 中的处理方式十分类似,在 Node.js 中,我们会在(异步操作)成功时调用 `done(null, data)`,在失败时调用 `done(err)`。
|
||||
Replit 是一个真实的服务器,在其中,通过 handler 函数和数据库交互。 这些函数会在特定事件(比如有人调用了我们的服务器 API)发生时执行。 接下来的挑战题目即是以此为基础。 `done()` 是一个回调函数,它的作用是在一个异步操作(比如对数据库进行插入、查询、更新或删除)执行完成时,通知我们可以继续执行后续的其它代码。 这与 Node.js 中的处理方式十分类似,在 Node.js 中,我们会在(异步操作)成功时调用 `done(null, data)`,在失败时调用 `done(err)`。
|
||||
|
||||
注意:与远程服务器进行交互时,我们需要考虑到发生错误的可能!
|
||||
|
||||
|
@@ -11,7 +11,7 @@ dashedName: install-and-set-up-mongoose
|
||||
可以采用下面的任意一种方式完成这些挑战:
|
||||
|
||||
- 克隆 [GitHub repo](https://github.com/freeCodeCamp/boilerplate-mongomongoose/) 并在本地完成项目。
|
||||
- 使用 [Repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-mongomongoose)来完成项目。
|
||||
- 使用[我们的 Replit 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-mongomongoose)来完成项目。
|
||||
- 使用你选择的网站生成器来完成项目, 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 中。
|
||||
|
@@ -18,7 +18,7 @@ dashedName: implementation-of-social-authentication
|
||||
|
||||
在 OAuth 验证策略中,我们至少需要提供 *Client ID* 和 *Client Secret*,这样第三方平台就会获悉验证请求的来源,以及这个来源是否有效。 为此,需要去我们使用的第三方验证平台(比如 GitHub)获取这两个字段的值。 注意,我们获取到的这个值是唯一的,仅对我们的当前 app 有效——**因此,千万不要分享给别人**,更不要上传到公共仓库或者直接写在代码里。 通常,我们会把它们放在 `.env` 文件里,并通过 `process.env.GITHUB_CLIENT_ID` 获取。 对于这次挑战,我们将会使用 GitHub 作为验证平台。
|
||||
|
||||
首先,你需要进入账户设置里的 “developer settings(开发者设置)”板块,在 '[OAuth applications](https://github.com/settings/developers)' 获取 *Client ID and Secret*。 点击 “Register a new application”,设置你的应用名称,然后把你的 Repl.it 主页地址(**不是项目代码的地址**)粘贴到 Homepage URL。然后,回调 url 需要设置成上面 Homepage URL 里你粘贴的地址,但后面要加上 `/auth/github/callback`。 这样在用户通过 Github 验证后才能跳转到我们指定的页面。 在你的 `.env` 文件里将返回的信息保存为 `'GITHUB_CLIENT_ID'` 和 `'GITHUB_CLIENT_SECRET'`。
|
||||
首先,你需要进入账户设置里的 “developer settings(开发者设置)”板块,在 '[OAuth applications](https://github.com/settings/developers)' 获取 *Client ID and Secret*。 点击 “Register a new application(注册一个新的应用)”,设置你的应用名称,然后把你的 Replit 主页地址(**不是项目代码的 url**)粘贴到 Homepage URL。然后,回调 url 需要设置成上面 Homepage URL 里你粘贴的地址,但后面要加上 `/auth/github/callback`。 这样在用户通过 Github 验证后才能跳转到我们指定的页面。 在你的 `.env` 文件里将返回的信息保存为 `'GITHUB_CLIENT_ID'` 和 `'GITHUB_CLIENT_SECRET'`。
|
||||
|
||||
在你的 `routes.js` 文件中,添加 `showSocialAuth: true` 到主页路由,在 `showRegistration: true` 的后面。 然后,为 `/auth/github` 和 `/auth/github/callback` 创建两个接收 GET 请求的路由。 第一个只需要通过调用 passport 来验证 `'github'`。 第二个应该调用 passport 来验证 `'github'`,但需要在失败时跳转回主页 `/`,成功时跳转到用户页面 `/profile`(跳转的逻辑与上一个项目中的逻辑一样)。
|
||||
|
||||
|
@@ -11,7 +11,7 @@ dashedName: set-up-a-template-engine
|
||||
你可以采用下面的任意一种方式完成这些挑战:
|
||||
|
||||
- 克隆[这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-advancednode/),在本地完成这些挑战。
|
||||
- 使用[我们在 Repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-advancednode)来完成这些挑战。
|
||||
- 使用[我们的 Replit 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-advancednode)来完成项目。
|
||||
- 使用一个你选择的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。
|
||||
|
@@ -8,7 +8,7 @@ dashedName: assert-deep-equality-with--deepequal-and--notdeepequal
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在 [这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 的基础上进行开发。 你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`deepEqual()` 断言两个对象是否深度相等。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: compare-the-properties-of-two-elements
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在 [这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 的基础上进行开发。 你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
@@ -11,7 +11,7 @@ dashedName: learn-how-javascript-assertions-work
|
||||
你可以采用下面的任意一种方式完成这些挑战:
|
||||
|
||||
- 克隆[这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-mochachai/)并在本地完成项目。
|
||||
- 使用[我们在 Repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)来完成这些挑战。
|
||||
- 使用[我们的 Replit 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)来完成项目。
|
||||
- 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。
|
||||
|
@@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-an-api-response-using-chai-http-iii---put-me
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在 [这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
接下来,我们将了解如何使用请求的 payload(body)发送数据。 我们需要测试一个 PUT 请求, `'/travellers'` 接收如下的 JSON 对象:
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-an-api-response-using-chai-http-iv---put-met
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在 [这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。 这个练习与上一个类似, 我们详细看看。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。 这个练习与上一个类似, 我们详细看看。
|
||||
|
||||
你已经看到了它是如何完成的,现在你需要从零开始搭建。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-api-endpoints-using-chai-http-ii
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。 你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-api-endpoints-using-chai-http
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
Mocha 允许测试异步操作。 有一个差异, 你能发现它吗?
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: run-functional-tests-using-a-headless-browser-ii
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: run-functional-tests-using-a-headless-browser
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。 你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
在 HTML 主视图中有一个输入表格。 它发送数据到 `PUT /travellers` 端点,我们在上面的 Ajax 请求中使用。 当请求成功完成时,客户端代码会给 DOM 增加一个包含调用返回信息的 `<div>`。 下面的例子展示了如何使用这个表格:
|
||||
|
||||
@@ -18,7 +18,7 @@ test('#test - submit the input "surname" : "Polo"', function (done) {
|
||||
browser.assert.success();
|
||||
browser.assert.text('span#name', 'Marco');
|
||||
browser.assert.text('span#surname', 'Polo');
|
||||
browser.assert.element('span#dates', 1);
|
||||
browser.assert.elements('span#dates', 1);
|
||||
done();
|
||||
});
|
||||
}
|
||||
@@ -119,7 +119,7 @@ test('#test - submit the input "surname" : "Polo"', function (done) {
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(
|
||||
(data) => {
|
||||
assert.equal(data.assertions[3].method, 'browser.element');
|
||||
assert.equal(data.assertions[3].method, 'browser.elements');
|
||||
assert.match(data.assertions[3].args[0], /('|")span#dates\1/);
|
||||
assert.equal(data.assertions[3].args[1], 1);
|
||||
},
|
||||
|
@@ -7,13 +7,13 @@ dashedName: simulate-actions-using-a-headless-browser
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
在接下来的挑战中,我们将使用名为 “Headless Browser(无头浏览器)” 的设备模拟人与页面的交互。
|
||||
|
||||
无头浏览器是没有图形用户界面的 Web 浏览器。 这种工具对于测试网页特别有用,因为它能够以与浏览器相同的方式呈现和理解 HTML、CSS 和 JavaScript。
|
||||
|
||||
针对这些挑战,我们使用 Zombie.JS。 它是一个轻量级浏览器,完全基于 JS,而不需要额外的二进制文件来安装。 这个功能使我们可以在 Repl.it 等环境中使用它。 还有许多其他(更强大的)选择。
|
||||
针对这些挑战,我们使用 Zombie.JS。 它是一个轻量级浏览器,完全基于 JS,而不需要额外的二进制文件来安装。 这个特性使我们可以在 Replit 等环境中使用它。 还有许多其他(更强大的)选择。
|
||||
|
||||
Mocha 允许你在实际测试之前准备一些代码运行的基础。 这可能有助于例如在数据库中创建项目,用于连续测试。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-for-truthiness
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`isTrue()` 仅当给出的值为 Boolean 的 `true` 时可以通过测试;`isNotTrue()` 则会在给出除 `true` 以外的值时通过测试。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-a-string-contains-a-substring
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`include()` 和 `notInclude()` 同样可以用于字符串。 `include()` 用于断言字符串中包含某个子字符串。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-a-value-falls-within-a-specific-range
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在 [这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 的基础上进行开发。 你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
```javascript
|
||||
.approximately(actual, expected, delta, [message])
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-a-value-is-a-string
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`isString` 或 `isNotString` 断言一个值是否为字符串。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-a-value-is-an-array
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-a-value-is-of-a-specific-data-structure-type
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`#typeOf` 断言一个值的类型符合给定的类型,这个类型与 `Object.prototype.toString` 一致。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-a-variable-or-function-is-defined
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-an-array-contains-an-item
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-an-object-has-a-property
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`property` 断言一个对象含有给定属性。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-an-object-is-an-instance-of-a-constructor
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`#instanceOf` 断言一个对象是一个构造器的实例。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: test-if-one-value-is-below-or-at-least-as-large-as-another
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: use-assert-isok-and-assert-isnotok
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`isOk()` 用来测试值是否为真值,`isNotOk()` 用来测试值是否为假值。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: use-regular-expressions-to-test-a-string
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`match()` 断言一个值匹配一个正则表达式(第二个参数)。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: use-the-double-equals-to-assert-equality
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`equal()` 使用 `==` 比较对象。
|
||||
|
||||
|
@@ -8,7 +8,7 @@ dashedName: use-the-triple-equals-to-assert-strict-equality
|
||||
|
||||
# --description--
|
||||
|
||||
请注意,本项目在[这个 Repl.it 项目](https://repl.it/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
请注意,本项目在[这个 Replit 项目](https://replit.com/github/freeCodeCamp/boilerplate-mochachai)的基础上进行开发。你也可以从 [GitHub](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) 上克隆。
|
||||
|
||||
`strictEqual()` 使用 `===` 比较对象。
|
||||
|
||||
|
@@ -10,7 +10,7 @@ dashedName: american-british-translator
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://american-british-translator.freecodecamp.rocks/>。 可以采用下面的任意一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-project-american-british-english-translator/) 并在本地完成项目。
|
||||
- 使用 [repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-american-british-english-translator) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-american-british-english-translator)来完成你的项目。
|
||||
- 使用您选择的站点生成器来完成项目。 并确保包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
当完成本项目,请确认有一个可以公开访问的正常运行 demo 。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
@@ -21,8 +21,8 @@ dashedName: american-british-translator
|
||||
- 在 `/routes/api.js` 中完成 `/api/translate` 路由
|
||||
- 在 `tests/1_unit-tests.js` 和 `tests/2_functional-tests.js` 中创建所有 unit/functional 测试
|
||||
- 查看 `/components` 中的 JavaScript 文件以获取应用程序应该翻译的条款以及不同的拼写
|
||||
- 在 `.env` 文件中将 `NODE_ENV` 设置为 `test`(没有引号),运行 Repl.it 上的测试。
|
||||
- 使用 `npm run test` 命令,在 console 运行测试。 按 Ctrl+Shift+P (在 Mac 上是 Cmd+Shift+P) 并输入"open shell",打开 Repl.it 控制台。
|
||||
- 在 `.env` 文件中将 `NODE_ENV` 设置为 `test`(没有引号),在 Replit 上运行测试。
|
||||
- 使用 `npm run test` 命令,在 console 运行测试。 按 Ctrl+Shift+P(在 Mac 上是 Cmd+Shift+P),并输入“open shell”,打开 Replit 控制台。
|
||||
|
||||
在 `tests/1_unit-tests.js` 中写下以下测试:
|
||||
|
||||
|
@@ -11,7 +11,7 @@ dashedName: issue-tracker
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似: <https://issue-tracker.freecodecamp.rocks/>。 可以采用下面的任意一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-project-issuetracker/) 并在本地完成你的项目。
|
||||
- 使用 [repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-issuetracker) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-issuetracker)来完成你的项目。
|
||||
- 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
@@ -22,7 +22,7 @@ dashedName: issue-tracker
|
||||
- 在 `tests/2_functional-tests.js` 中创建所有的功能测试
|
||||
- 复制 `sample.env` 文件到 `.env` 并按需设置变量
|
||||
- 要运行测试,在 `.env` 文件中取消注释 `NODE_ENV=test`
|
||||
- 使用 `npm run test` 命令,在 console 运行测试。 按 Ctrl+Shift+P (在 Mac 上是 Cmd+Shift+P) 并输入"open shell",打开 Repl.it 控制台。
|
||||
- 使用 `npm run test` 命令,在 console 运行测试。 按 Ctrl+Shift+P(在 Mac 上是 Cmd+Shift+P),并输入“open shell”,打开 Replit 控制台。
|
||||
|
||||
在 `tests/2_functional-tests.js` 中编写下以下测试:
|
||||
|
||||
|
@@ -11,7 +11,7 @@ dashedName: metric-imperial-converter
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://metric-imperial-converter.freecodecamp.rocks/>。 可以采用下面的任意一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-project-metricimpconverter/) 并在本地完成你的项目。
|
||||
- 使用 [repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-metricimpconverter) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-metricimpconverter)来完成你的项目。
|
||||
- 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
@@ -22,7 +22,7 @@ dashedName: metric-imperial-converter
|
||||
- 在 `/routes/api.js` 中完成必要的路由
|
||||
- 复制 `sample.env` 文件到 `.env` 并按需设置变量
|
||||
- 在 `.env` 文件中取消注释 `NODE_ENV=test` 来运行测试
|
||||
- 使用 `npm run test` 命令在 console 中运行测试。 按 Ctrl+Shift+P (在 Mac 上是 Cmd+Shift+P) 并输入"open shell",打开 Repl.it 控制台。
|
||||
- 使用 `npm run test` 命令在 console 中运行测试。 按 Ctrl+Shift+P(在 Mac 上是 Cmd+Shift+P),并输入“open shell”,打开 Replit 控制台。
|
||||
|
||||
在 `tests/1_unit-tests.js` 中写下以下测试:
|
||||
|
||||
|
@@ -11,7 +11,7 @@ dashedName: personal-library
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://personal-library.freecodecamp.rocks/>。 可以采用下面的任意一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-project-library) 并在本地完成项目。
|
||||
- 使用 [repl.it 上的初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-library) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-library)来完成你的项目。
|
||||
- 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
|
@@ -10,7 +10,7 @@ dashedName: sudoku-solver
|
||||
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://sudoku-solver.freecodecamp.rocks/>。 可以采用下面的任意一种方式完成这个挑战:
|
||||
|
||||
- 克隆 [GitHub 仓库](https://github.com/freecodecamp/boilerplate-project-sudoku-solver) 并在本地完成你的项目。
|
||||
- 使用 [repl.it 初始化项目](https://repl.it/github/freeCodeCamp/boilerplate-project-sudoku-solver) 来完成项目。
|
||||
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-sudoku-solver)来完成你的项目。
|
||||
- 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
|
||||
|
||||
完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
|
||||
@@ -24,7 +24,7 @@ dashedName: sudoku-solver
|
||||
- 所有路由逻辑都可以进入 `/routes/api.js`
|
||||
- 阅读 `/controllers` 中的 `puzzle-strings.js` 文件来了解一些应用程序应该解决的示例谜题
|
||||
- 在 `.env` 文件中将 `NODE_ENV` 设置为 `test` (没有引号),运行这个页面的挑战测试。
|
||||
- 使用 `npm run test` 命令在 console 中运行测试。 按 Ctrl+Shift+P (在 Mac 上是 Cmd+Shift+P) 并输入"open shell",打开 Repl.it 控制台。
|
||||
- 使用 `npm run test` 命令在 console 中运行测试。 按 Ctrl+Shift+P(在 Mac 上是 Cmd+Shift+P),并输入“open shell”,打开 Replit 控制台。
|
||||
|
||||
在 `tests/1_unit-tests.js` 中写下以下测试:
|
||||
|
||||
|
Reference in New Issue
Block a user