chore(i18n,curriculum): processed translations (#42115)

This commit is contained in:
camperbot
2021-05-12 21:25:58 +05:30
committed by GitHub
parent 7f8f4dad63
commit 7aaa365393
86 changed files with 194 additions and 186 deletions

View File

@ -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();

View File

@ -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` 中。

View File

@ -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` 中。

View File

@ -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();

View File

@ -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`

View File

@ -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 上,右側邊欄會默認打開一個終端。
我們建議在做這些挑戰題時保持終端打開的狀態。 通過這些終端的輸出,你可能會發現這些錯誤的本質原因。

View File

@ -22,7 +22,7 @@ function(req, res) {
# --instructions--
當 GET 請求 `/`(根路由 )時,使用 `app.get()` 方法響應一個“Hello Express”字符串。 通過查看日誌確保代碼正常運行,如果使用 Repl.it 可以在預覽中查看結果。
當 GET 請求 `/`(根路由 )時,使用 `app.get()` 方法響應一個“Hello Express”字符串。 通過查看日誌確保代碼正常運行,如果使用 Replit 可以在預覽中查看結果。
**注意:** 這些課程的所有代碼應該放在開始給出的幾行代碼之間。

View File

@ -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) =>

View File

@ -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` 中。

View File

@ -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)`
注意:與遠程服務器進行交互時,我們需要考慮到發生錯誤的可能!

View File

@ -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` 中。

View File

@ -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`(跳轉的邏輯與上一個項目中的邏輯一樣)。

View File

@ -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。

View File

@ -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()` 斷言兩個對象是否深度相等。

View File

@ -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--

View File

@ -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。

View File

@ -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) 上克隆。
接下來,我們將瞭解如何使用請求的 payloadbody發送數據。 我們需要測試一個 PUT 請求, `'/travellers'` 接收如下的 JSON 對象:

View File

@ -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) 上克隆。 這個練習與上一個類似, 我們詳細看看。
你已經看到了它是如何完成的,現在你需要從零開始搭建。

View File

@ -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--

View File

@ -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 允許測試異步操作。 有一個差異, 你能發現它嗎?

View File

@ -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--

View File

@ -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);
},

View File

@ -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 允許你在實際測試之前準備一些代碼運行的基礎。 這可能有助於例如在數據庫中創建項目,用於連續測試。

View File

@ -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` 以外的值時通過測試。

View File

@ -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()` 用於斷言字符串中包含某個子字符串。

View File

@ -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])

View File

@ -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` 斷言一個值是否爲字符串。

View File

@ -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--

View File

@ -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` 一致。

View File

@ -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--

View File

@ -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--

View File

@ -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` 斷言一個對象含有給定屬性。

View File

@ -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` 斷言一個對象是一個構造器的實例。

View File

@ -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--

View File

@ -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()` 用來測試值是否爲假值。

View File

@ -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()` 斷言一個值匹配一個正則表達式(第二個參數)。

View File

@ -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()` 使用 `==` 比較對象。

View File

@ -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()` 使用 `===` 比較對象。

View File

@ -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` 中寫下以下測試:

View File

@ -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` 中編寫下以下測試:

View File

@ -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` 中寫下以下測試:

View File

@ -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` 中。

View File

@ -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` 中寫下以下測試:

View File

@ -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();

View File

@ -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` 中。

View File

@ -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` 中。

View File

@ -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();

View File

@ -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`

View File

@ -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 上,右侧边栏会默认打开一个终端。
我们建议在做这些挑战题时保持终端打开的状态。 通过这些终端的输出,你可能会发现这些错误的本质原因。

View File

@ -22,7 +22,7 @@ function(req, res) {
# --instructions--
当 GET 请求 `/`(根路由 )时,使用 `app.get()` 方法响应一个“Hello Express”字符串。 通过查看日志确保代码正常运行,如果使用 Repl.it 可以在预览中查看结果。
当 GET 请求 `/`(根路由 )时,使用 `app.get()` 方法响应一个“Hello Express”字符串。 通过查看日志确保代码正常运行,如果使用 Replit 可以在预览中查看结果。
**注意:** 这些课程的所有代码应该放在开始给出的几行代码之间。

View File

@ -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) =>

View File

@ -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` 中。

View File

@ -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)`
注意:与远程服务器进行交互时,我们需要考虑到发生错误的可能!

View File

@ -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` 中。

View File

@ -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`(跳转的逻辑与上一个项目中的逻辑一样)。

View File

@ -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。

View File

@ -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()` 断言两个对象是否深度相等。

View File

@ -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--

View File

@ -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。

View File

@ -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) 上克隆。
接下来,我们将了解如何使用请求的 payloadbody发送数据。 我们需要测试一个 PUT 请求, `'/travellers'` 接收如下的 JSON 对象:

View File

@ -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) 上克隆。 这个练习与上一个类似, 我们详细看看。
你已经看到了它是如何完成的,现在你需要从零开始搭建。

View File

@ -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--

View File

@ -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 允许测试异步操作。 有一个差异, 你能发现它吗?

View File

@ -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--

View File

@ -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);
},

View File

@ -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 允许你在实际测试之前准备一些代码运行的基础。 这可能有助于例如在数据库中创建项目,用于连续测试。

View File

@ -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` 以外的值时通过测试。

View File

@ -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()` 用于断言字符串中包含某个子字符串。

View File

@ -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])

View File

@ -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` 断言一个值是否为字符串。

View File

@ -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--

View File

@ -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` 一致。

View File

@ -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--

View File

@ -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--

View File

@ -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` 断言一个对象含有给定属性。

View File

@ -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` 断言一个对象是一个构造器的实例。

View File

@ -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--

View File

@ -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()` 用来测试值是否为假值。

View File

@ -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()` 断言一个值匹配一个正则表达式(第二个参数)。

View File

@ -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()` 使用 `==` 比较对象。

View File

@ -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()` 使用 `===` 比较对象。

View File

@ -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` 中写下以下测试:

View File

@ -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` 中编写下以下测试:

View File

@ -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` 中写下以下测试:

View File

@ -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` 中。

View File

@ -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` 中写下以下测试: