chore(i18n,chn): manually downloaded curriculum (#42858)

This commit is contained in:
Mrugesh Mohapatra
2021-07-15 13:04:11 +05:30
committed by GitHub
parent eef1805fe6
commit 7eb0630f2d
248 changed files with 5645 additions and 2149 deletions

View File

@@ -1,6 +1,6 @@
---
id: 587d824a367417b2b2512c45
title: Anonymous Message Board
title: 匿名留言板
challengeType: 4
forumTopicId: 301568
dashedName: anonymous-message-board
@@ -8,38 +8,38 @@ dashedName: anonymous-message-board
# --description--
Build a full stack JavaScript app that is functionally similar to this: <https://anonymous-message-board.freecodecamp.rocks/>.
构建一个功能上与此相似的全栈式 JavaScript 应用程序:<https://anonymous-message-board.freecodecamp.rocks/>
Working on this project will involve you writing your code using one of the following methods:
在这个项目中,你将使用以下方法之一编写你的代码:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-messageboard/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-messageboard) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
- 克隆[这个 GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-messageboard/) 并在本地完成你的项目。
- 使用 [我们的 Replit 启动项目](https://replit.com/github/freeCodeCamp/boilerplate-project-messageboard)来完成你的项目。
- 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field.
完成本项目后,请将一个正常运行的 demo项目演示托管在可以公开访问的平台。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --instructions--
1. Set `NODE_ENV` to test without quotes when ready to write tests and DB to your databases connection string (in `.env`)
2. Recommended to create controllers/handlers and handle routing in `routes/api.js`
3. You will add any security features to `server.js`
1. 当准备写测试和数据库连接字符串时,设置`NODE_ENV`为不带引号的变量(在`.env`文件中)。
2. 建议在 `routes/api.js` 中创建控制器/处理器并处理路由。
3. 你将在 `server.js` 中添加任何安全功能。
Write the following tests in `tests/2_functional-tests.js`:
`tests/2_functional-tests.js` 中编写下以下测试:
- Creating a new thread: POST request to `/api/threads/{board}`
- Viewing the 10 most recent threads with 3 replies each: GET request to `/api/threads/{board}`
- Deleting a thread with the incorrect password: DELETE request to `/api/threads/{board}` with an invalid `delete_password`
- Deleting a thread with the correct password: DELETE request to `/api/threads/{board}` with a valid `delete_password`
- Reporting a thread: PUT request to `/api/threads/{board}`
- Creating a new reply: POST request to `/api/replies/{board}`
- Viewing a single thread with all replies: GET request to `/api/replies/{board}`
- Deleting a reply with the incorrect password: DELETE request to `/api/threads/{board}` with an invalid `delete_password`
- Deleting a reply with the correct password: DELETE request to `/api/threads/{board}` with a valid `delete_password`
- Reporting a reply: PUT request to `/api/replies/{board}`
- 创建一个新的主题:发送 POST 请求到 `/api/threads/{board}`
- 查看最近的 10 个主题,每个主题有 3 个回复:发送 GET 请求到 `/api/threads/{board}`
- 使用错误密码删除主题:使用错误的`delete_password``/api/threads/{board}`发出DELETE请求
- 用正确的密码删除一个主题:向`/api/threads/{board}`发出DELETE请求并提供有效的`delete_password`
- 报告一个主题:发送 PUT 请求到 `/api/threads/{board}`
- 创建一个新的回复:发送 POST 请求到 `/api/replies/{board}`
- 查看一个带有所有回复的主题:发送 GET 请求到`/api/replies/{board}`
- 使用错误密码删除一个回复:使用无效的`delete_password``/api/replies/{board}`发出DELETE请求。
- 使用正确密码删除一个回复:使用有效的`delete_password``/api/replies/{board}`发出DELETE请求。
- 报告一个回复:发送 PUT 请求到 `/api/replies/{board}`
# --hints--
You can provide your own project, not the example URL.
提交自己的项目,而不是示例的 URL
```js
(getUserInput) => {
@@ -51,7 +51,7 @@ You can provide your own project, not the example URL.
};
```
Only allow your site to be loaded in an iFrame on your own pages.
只允许你的网站在你自己的页面上以 iFrame 方式加载。
```js
async (getUserInput) => {
@@ -61,7 +61,7 @@ async (getUserInput) => {
};
```
Do not allow DNS prefetching.
不允许 DNS 预取。
```js
async (getUserInput) => {
@@ -71,7 +71,7 @@ async (getUserInput) => {
};
```
Only allow your site to send the referrer for your own pages.
只允许你的网站为你自己的页面发送 referrer 请求头。
```js
async (getUserInput) => {
@@ -81,55 +81,81 @@ async (getUserInput) => {
};
```
You can send a POST request to `/api/threads/{board}` with form data including `text` and `delete_password`. The saved database record will have at least the fields `_id`, `text`, `created_on`(date & time), `bumped_on`(date & time, starts same as `created_on`), `reported` (boolean), `delete_password`, & `replies` (array).
你可以向 `/api/threads/{board}` 发送一个 POST 请求,其中包括 `text` `delete_password` 的表单数据。 保存的数据库记录将至少有 `_id``text``created_on`(date & time)`bumped_on`(date & time, starts same as `created_on`)`reported`(布尔值)、`delete_password`& `replies`(数组)。
```js
async (getUserInput) => {
const date = new Date();
const text = `fcc_test_${date}`;
const deletePassword = 'delete_me';
const data = { text, delete_password: deletePassword };
const url = getUserInput('url');
const res = await fetch(url + '/api/threads/fcc_test', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
if (res.ok) {
const checkData = await fetch(url + '/api/threads/fcc_test');
const parsed = await checkData.json();
try {
assert.equal(parsed[0].text, text);
assert.isNotNull(parsed[0]._id);
assert.equal(new Date(parsed[0].created_on).toDateString(), date.toDateString());
assert.equal(parsed[0].bumped_on, parsed[0].created_on);
assert.isArray(parsed[0].replies);
} catch (err) {
throw new Error(err.responseText || err.message);
}
} else {
throw new Error(`${res.status} ${res.statusText}`);
}
};
```
你可以向 `/api/replies/{board}` 发送一个 POST 请求,其中包括字段 `text``delete_password` & `thread_id`。 这将更新 `bumped_on` 日期到评论日期。 在主题的 `replies` 数组中,将保存一个对象,至少有 `_id``text``created_on``delete_password`& `reported` 这些属性。
```js
```
You can send a POST request to `/api/replies/{board}` with form data including `text`, `delete_password`, & `thread_id`. This will update the `bumped_on` date to the comment's date. In the thread's `replies` array, an object will be saved with at least the properties `_id`, `text`, `created_on`, `delete_password`, & `reported`.
你可以向 `/api/threads/{board}` 发送一个 GET 请求。 返回的将是一个数组,包括论坛上最近的 10 个被回复的主题,及每个主题最新的 3 个回帖。 `reported` `delete_password` 字段将不会被发送到客户端。
```js
```
You can send a GET request to `/api/threads/{board}`. Returned will be an array of the most recent 10 bumped threads on the board with only the most recent 3 replies for each. The `reported` and `delete_password` fields will not be sent to the client.
你可以向 `/api/replies/{board}?thread_id={thread_id}` 发送一个 GET 请求。 返回的将是带有所有的回复的整个主题,不包括与之前测试相同的客户端字段。
```js
```
You can send a GET request to `/api/replies/{board}?thread_id={thread_id}`. Returned will be the entire thread with all its replies, also excluding the same fields from the client as the previous test.
你可以向 `/api/threads/{board}` 发送一个 DELETE 请求,并传递 `thread_id` & `delete_password` 来删除该线程。 返回的将是字符串 `incorrect password``success`
```js
```
You can send a DELETE request to `/api/threads/{board}` and pass along the `thread_id` & `delete_password` to delete the thread. Returned will be the string `incorrect password` or `success`.
你可以向 `/api/replies/{board}` 发送一个 DELETE 请求,并传递 `thread_id``reply_id`& `delete_password`。 返回的将是字符串 `incorrect password` `success`。 成功后,`reply_id` 的文本将更改为 `[deleted]`
```js
```
You can send a DELETE request to `/api/replies/{board}` and pass along the `thread_id`, `reply_id`, & `delete_password`. Returned will be the string `incorrect password` or `success`. On success, the text of the `reply_id` will be changed to `[deleted]`.
你可以向 `/api/threads/{board}` 发送一个 PUT 请求,并传递 `thread_id`。 返回的将是字符串 `success``thread_id` 回复的 `reported` 值将改为 `true`
```js
```
You can send a PUT request to `/api/threads/{board}` and pass along the `thread_id`. Returned will be the string `success`. The `reported` value of the `thread_id` will be changed to `true`.
你可以通过向 `/api/replies/{board}` 发送 PUT 请求并传递 `thread_id` & `reply_id`。 返回的将是字符串 `success` `reply_id``reported` 值将被改变为 `true`
```js
```
You can send a PUT request to `/api/replies/{board}` and pass along the `thread_id` & `reply_id`. Returned will be the string `success`. The `reported` value of the `reply_id` will be changed to `true`.
```js
```
All 10 functional tests are complete and passing.
所有 10 项功能测试都已完成并通过。
```js

View File

@@ -1,33 +1,34 @@
---
id: 5e46f979ac417301a38fb932
title: Port Scanner
title: 端口扫描器
challengeType: 10
forumTopicId: 462372
helpCategory: Python
dashedName: port-scanner
---
# --description--
Create a port scanner using Python.
使用 Python 创建一个端口扫描器。
You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-port-scanner).
你可以访问 [Replit 上的完整项目描述和启动代码](https://replit.com/github/freeCodeCamp/boilerplate-port-scanner)
After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below.
在打开链接之后 fork 该项目。 根据 “README.md” 中的指示完成整个项目,然后在下面提交你的项目链接。
We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you some of the Python skills required for this project:
Python 课程的交互式教学部分仍在开发当中。 目前,freeCodeCamp YouTube 频道上的一些视频将会教授你这个项目要求的一些 Python 技能。
<ul>
<li>
<a href='https://www.freecodecamp.org/news/python-for-everybody/'>Python for Everybody Video Course</a> (14 hours)
<a href='https://www.freecodecamp.org/news/python-for-everybody/'>Python for Everybody 视频课程</a>14 小时)
</li>
<li>
<a href='https://www.freecodecamp.org/news/learn-python-basics-in-depth-video-course/'>Learn Python Video Course</a> (2 hours)
<a href='https://www.freecodecamp.org/news/learn-python-basics-in-depth-video-course/'>Learn Python 视频课程</a>2 小时)
</li>
</ul>
# --hints--
It should pass all Python tests.
它应该通过所有的 Python 测试。
```js

View File

@@ -1,23 +1,28 @@
---
id: 5e601c775ac9d0ecd8b94aff
title: Secure Real Time Multiplayer Game
title: 安全的实时多人游戏
challengeType: 4
forumTopicId: 462375
dashedName: secure-real-time-multiplayer-game
---
# --description--
Develop a 2D real time multiplayer game using the HTML Canvas API and [Socket.io](https://socket.io/) that is functionally similar to this: <https://secure-real-time-multiplayer-game.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
使用 HTML Canvas API [Socket.io](https://socket.io/) 开发一个 2D 实时多人游戏,其功能与此类似:<https://secure-real-time-multiplayer-game.freecodecamp.rocks/>。 在这个项目中,你将使用以下方法之一编写你的代码:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
- 克隆[这个 GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game/),并在本地完成你的项目。
- 使用[我们的 Replit 初始项目](https://replit.com/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game)来完成你的项目。
- 使用您选择的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
完成本项目后,请将一个正常运行的 demo项目演示托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --instructions--
**注意** `helmet@^3.21.3` 是用户故事所必需的。 这意味着你需要使用以前版本的 Helmet 的文档,了解如何实现用户故事的信息。
# --hints--
You can provide your own project, not the example URL.
提交自己的项目,而不是示例的 URL
```js
(getUserInput) => {
@@ -29,112 +34,134 @@ You can provide your own project, not the example URL.
};
```
Multiple players can connect to a server and play.
多个玩家可以连接到一台服务器游玩。
```js
```
Each player has an avatar.
每个玩家都有头像。
```js
```
Each player is represented by an object created by the `Player` class in `Player.mjs`.
每个玩家都由在 `Player.mjs` 中创建的 `Player` 类对象来代表。
```js
```
At a minimum, each player object should contain a unique `id`, a `score`, and `x` and `y` coordinates representing the player's current position.
至少,每个玩家对象应该包含一个唯一的 `id`、一个 `score`,以及代表玩家当前位置的 `x` `y` 坐标。
```js
```
The game has at least one type of collectible item. Complete the `Collectible` class in `Collectible.mjs` to implement this.
游戏至少有一种类型的可收藏物品。 在 `Collectible.mjs` 中完成 `Collectible` 类来实现这一点。
```js
```
At a minimum, each collectible item object created by the `Collectible` class should contain a unique `id`, a `value`, and `x` and `y` coordinates representing the item's current position.
至少,每个由 `Collectible` 类创建的可收集物品对象应该包含一个唯一的 `id`、一个 `value`,以及代表该物品当前位置的 `x` `y` 坐标。
```js
```
Players can use the WASD and/or arrow keys to move their avatar. Complete the `movePlayer` method in `Player.mjs` to implement this.
玩家可以使用 WASD 或方向键移动头像。 完成 `Player.mjs` 中的 `movePlayer` 方法来实现这一功能。
```js
```
The `movePlayer` method should accept two arguments: a string of "up", "down", "left", or "right", and a number for the amount of pixels the player's position should change. `movePlayer` should adjust the `x` and `y` coordinates of the player object it's called from.
`movePlayer` 方法应该接受两个参数:一个是 “up”、“down”、“left” 或 “right” 的字符串,另一个是玩家角色位置应该改变的像素数量。 `movePlayer` 应该调整它所调用的玩家对象的 `x` `y` 坐标。
```js
```
The player's score should be used to calculate their rank among the other players. Complete the `calculateRank` method in the `Player` class to implement this.
用玩家的分数来计算他们相对其他玩家的名次。 在 `Player` 类中完成 `calculateRank` 方法来实现这个。
```js
```
The `calculateRank` method should accept an array of objects representing all connected players and return the string `Rank: currentRanking/totalPlayers`. For example, in a game with two players, if Player A has a score of 3 and Player B has a score of 5, `calculateRank` for Player A should return `Rank: 2/2`.
`calculateRank` 方法应该接受一个代表所有在线玩家的对象数组,并返回字符串 `Rank: currentRanking/totalPlayers`。 例如,在一局有两个玩家的游戏中,如果玩家 A 的分数是 3玩家 B 的分数是 5那么玩家 A 的 `calculateRank` 应该返回 `Rank: 2/2`
```js
```
Players can collide with a collectible item. Complete the `collision` method in `Player.mjs` to implement this.
玩家可以与可收集物品发生碰撞。 完成 `Player.mjs` 中的 `collision` 方法来实现这一点。
```js
```
The `collision` method should accept a collectible item's object as an argument. If the player's avatar intersects with the item, the `collision` method should return `true`.
`collision` 方法应该接受一个可收集物品的对象作为参数。 如果玩家的头像与物品相交,`collision` 方法应该返回 `true`
```js
```
All players are kept in sync.
所有玩家都保持游戏状态同步。
```js
```
Players can disconnect from the game at any time.
玩家可以随时断开与游戏的连接。
```js
```
Prevent the client from trying to guess / sniff the MIME type.
阻止客户端试图猜测/嗅探 MIME 类型。
```js
async (getUserInput) => {
const data = await fetch(getUserInput('url') + '/_api/app-info');
const parsed = await data.json();
assert.equal(parsed.headers['x-content-type-options'], 'nosniff');
};
```
Prevent cross-site scripting (XSS) attacks.
防止跨站脚本XSS攻击。
```js
async (getUserInput) => {
const data = await fetch(getUserInput('url') + '/_api/app-info');
const parsed = await data.json();
assert.equal(parsed.headers['x-xss-protection'], '1; mode=block');
};
```
Nothing from the website is cached in the client.
客户端没有缓存任何网站内容。
```js
async (getUserInput) => {
const data = await fetch(getUserInput('url') + '/_api/app-info');
const parsed = await data.json();
assert.equal(parsed.headers['surrogate-control'], 'no-store');
assert.equal(
parsed.headers['cache-control'],
'no-store, no-cache, must-revalidate, proxy-revalidate'
);
assert.equal(parsed.headers['pragma'], 'no-cache');
assert.equal(parsed.headers['expires'], '0');
};
```
The headers say that the site is powered by "PHP 7.4.3" even though it isn't (as a security measure).
请求头显示该网站是由 “PHP 7.4.3” 驱动的,尽管实际并非如此(作为一种安全防御措施)。
```js
async (getUserInput) => {
const data = await fetch(getUserInput('url') + '/_api/app-info');
const parsed = await data.json();
assert.equal(parsed.headers['x-powered-by'], 'PHP 7.4.3');
};
```
# --solutions--

View File

@@ -1,33 +1,34 @@
---
id: 5e46f983ac417301a38fb933
title: SHA-1 Password Cracker
title: SHA-1 密码破解器
challengeType: 10
forumTopicId: 462374
helpCategory: Python
dashedName: sha-1-password-cracker
---
# --description--
For this project you will learn about the importance of good security by creating a password cracker to figure out passwords that were hashed using SHA-1.
在这个项目中,你将通过创建一个密码破解器来找出使用 SHA-1 散列的密码,从而了解到良好安全的重要性。
You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-SHA-1-password-cracker).
你可以访问 [Replit 上的完整项目描述和启动代码](https://replit.com/github/freeCodeCamp/boilerplate-SHA-1-password-cracker)
After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below.
进入该链接后fork 该项目。 一旦你根据 “README.md” 中的说明完成了项目,请在下面提交你的项目链接。
We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you some of the Python skills required for this project:
我们仍在开发 Python 课程的交互式教学部分。 目前freeCodeCamp.org YouTube 频道上的一些视频可以教你这个项目所需的一些 Python 技能。
<ul>
<li>
<a href='https://www.freecodecamp.org/news/python-for-everybody/'>Python for Everybody Video Course</a> (14 hours)
<a href='https://www.freecodecamp.org/news/python-for-everybody/'>Python for Everybody 视频课程</a>14 小时)
</li>
<li>
<a href='https://www.freecodecamp.org/news/learn-python-basics-in-depth-video-course/'>Learn Python Video Course</a> (2 hours)
<a href='https://www.freecodecamp.org/news/learn-python-basics-in-depth-video-course/'>Learn Python 视频课程</a>2 小时)
</li>
</ul>
# --hints--
It should pass all Python tests.
它应该通过所有的 Python 测试。
```js

View File

@@ -1,6 +1,6 @@
---
id: 587d824a367417b2b2512c44
title: Stock Price Checker
title: 股票价格查看器
challengeType: 4
forumTopicId: 301572
dashedName: stock-price-checker
@@ -8,36 +8,36 @@ dashedName: stock-price-checker
# --description--
Build a full stack JavaScript app that is functionally similar to this: <https://stock-price-checker.freecodecamp.rocks/>.
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://stock-price-checker.freecodecamp.rocks/>
Since all reliable stock price APIs require an API key, we've built a workaround. Use <https://stock-price-checker-proxy.freecodecamp.rocks/> to get up-to-date stock price information without needing to sign up for your own key.
由于所有可靠的股票价格 API 都需要一个 API 密钥,我们已经建立了一个解决方案。 使用 [https://stock-price-checer-proxy.freecodecamp.rocks/](https://stock-price-checker-proxy.freecodecamp.rocks/) 获取最新的股票价格信息,而无需注册您自己的密钥。
Working on this project will involve you writing your code using one of the following methods:
可以采用下面的任意一种方式完成这个挑战:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-stockchecker/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-stockchecker) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-stockchecker/) 并在本地完成项目。
- 使用[我们的 Replit 启动项目](https://replit.com/github/freeCodeCamp/boilerplate-project-stockchecker)来完成你的项目。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field.
完成本项目后,请将一个正常运行的 demo项目演示托管在可以公开访问的平台。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --instructions--
1. SET `NODE_ENV` to `test` without quotes and set `DB` to your MongoDB connection string
2. Complete the project in `routes/api.js` or by creating a handler/controller
3. You will add any security features to `server.js`
4. You will create all of the functional tests in `tests/2_functional-tests.js`
1. `NODE_ENV` 设置为 `test`,不带引号,并将 `DB` 设为你的 MongoDB 连接字符串。
2. `routes/api.js` 中完成项目,或者通过创建一个处理程序/控制器来完成项目
3. 添加安全功能到 `server.js`
4. `tests/2_functional-tests.js` 中创建所有的功能测试
Write the following tests in `tests/2_functional-tests.js`:
`tests/2_functional-tests.js` 中编写下以下测试:
- Viewing one stock: GET request to `/api/stock-prices/`
- Viewing one stock and liking it: GET request to `/api/stock-prices/`
- Viewing the same stock and liking it again: GET request to `/api/stock-prices/`
- Viewing two stocks: GET request to `/api/stock-prices/`
- Viewing two stocks and liking them: GET request to `/api/stock-prices/`
- 查看股价:发送 GET 请求到 `/api/stock-prices/`
- 查看一个股票并关注它:发送 GET 请求到 `/api/stock-prices/`
- 查看同一只股票并再次发送关注:发送 GET 请求到 `/api/stock-prices/`
- 查看两只股票:发送 GET 请求到 `/api/stock-prices/`
- 查看两只股票并关注它:发送 GET 请求到 `/api/stock-prices/`
# --hints--
You can provide your own project, not the example URL.
提交自己的项目,而不是示例的 URL
```js
(getUserInput) => {
@@ -47,7 +47,7 @@ You can provide your own project, not the example URL.
};
```
You should set the content security policies to only allow loading of scripts and CSS from your server.
将内容安全策略设置为仅允许从服务器加载脚本和 CSS。
```js
async (getUserInput) => {
@@ -62,7 +62,7 @@ async (getUserInput) => {
};
```
You can send a `GET` request to `/api/stock-prices` with form data containing a NASDAQ stock ticker. Returned will be an object with the property `stockData`.
你可以向 `/api/stock-prices` 发送一个 `GET` 请求,将纳斯达克股票代码赋值给 `stock` 查询参数。 返回的对象将包含一个名为 `stockData` 的属性。
```js
async (getUserInput) => {
@@ -74,7 +74,7 @@ async (getUserInput) => {
};
```
The `stockData` property includes the `stock` ticker as a string, the `price` as a number, and `likes` as a number.
`stockData` 属性包括字符串 `stock` 代码、数字 `price`,以及数字 `likes`
```js
async (getUserInput) => {
@@ -89,13 +89,13 @@ async (getUserInput) => {
};
```
You can also pass along a `like` field as `true` (boolean) to have your like added to the stock(s). Only 1 like per IP should be accepted.
你也可以用作为 `true`(布尔值)来传递 `like` 字段,让你的偏好添加到股票中。 每个 IP 应该只接受 1 个赞。
```js
```
If you pass along 2 stocks, the returned value will be an array with information about both stocks. Instead of `likes`, it will display `rel_likes` (the difference between the likes on both stocks) for both `stockData` objects.
如果你传递了两只股票,返回值将是一个包含这两只股票信息的数组。 它将会显示对于两个 `stockData` 对象的 `rel_likes`(两只股票所获得的赞同数的区别),而不是 `likes`
```js
async (getUserInput) => {
@@ -110,7 +110,7 @@ async (getUserInput) => {
};
```
All 5 functional tests are complete and passing.
所有 5 项功能测试都已完成并通过。
```js
async (getUserInput) => {