-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add russian translation for times exercise.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Задача | ||
|
||
Напишите программу, которая будет принимать два аргумента в командной строке, | ||
содержащие хост и порт. Используйте `http.request` и отправте POST-запрос на | ||
|
||
```js | ||
url + '/users/create' | ||
``` | ||
с телом, содержащим `JSON.stringify` объект: | ||
|
||
```js | ||
{"user_id": 1} | ||
``` | ||
|
||
Сделайте это в пять раз и каждый раз увеличивайте свойство `user_id`, начиная с 1. | ||
|
||
Когда запросы будут завершены, отправьте GET-запрос на: | ||
|
||
```js | ||
url + '/users' | ||
``` | ||
|
||
используйте `console.log` на тело ответа от GET-запроса. | ||
|
||
## Советы | ||
|
||
В этой задаче, вам необходимо будет координировать несколько асинхронное операций. | ||
|
||
Используйте `async.series` для этого и передать в` Object`. В одной из функций | ||
нужно использовать `async.times`, чтобы отправить POST-request используя `http.request`. | ||
Другая будет делать GET-запрос. | ||
|
||
Вы можете прочитать больше о функции `async.times` здесь: | ||
|
||
https://github.com/caolan/async#times |