mirror of https://github.com/01-edu/public.git
docs(gougle-search): correct grammar
This commit is contained in:
parent
5e8ef51a75
commit
44cfb248db
|
@ -2,16 +2,11 @@
|
|||
|
||||
### Instructions
|
||||
|
||||
Create the `queryServers` function, that takes 2 arguments:
|
||||
|
||||
- `serverName` a string of the name of the server
|
||||
- `q` a string of the query given by the user
|
||||
|
||||
You have to construct 2 urls, using `q` as a search parameter,
|
||||
prepending a `'/'` and for the 2nd appending `'_backup'`.
|
||||
|
||||
Then return the first value of those 2 calls
|
||||
Create a function named `queryServers` that takes 2 arguments:
|
||||
- `serverName`: a string of the name of the server.
|
||||
- `q`: a string of the query given by the user.
|
||||
|
||||
You need to construct 2 urls which should work like this:
|
||||
```js
|
||||
queryServers('pouet', 'hello+world')
|
||||
// return the fastest of those 2 calls:
|
||||
|
@ -19,25 +14,26 @@ queryServers('pouet', 'hello+world')
|
|||
// -> getJSON('/pouet_backup?q=hello+world')
|
||||
```
|
||||
|
||||
Create a `gougleSearch` function that takes a single query argument.
|
||||
It must call `queryServers` in concurrently on 3 servers:
|
||||
`'web'`, `'image'` and `'video'`.
|
||||
Create a function named: `gougleSearch` that takes a single query argument (`q`). It must invoke `queryServers` concurrently on 3 servers:
|
||||
- `"web"`
|
||||
- `"image"`
|
||||
- `"video"`
|
||||
|
||||
A timeout of 80milliseconds must be set for the whole operation.
|
||||
You must return the value from each server in an object using the server name as key.
|
||||
|
||||
You must return the value from each server in an object
|
||||
using the server name as key.
|
||||
A timeout of 80milliseconds must be set for the whole operation, if it is not complete within 80 milliseconds, then you must return `Error('timeout')`.
|
||||
|
||||
### Notions
|
||||
|
||||
- [devdocs.io/javascript/global_objects/promise/race](https://devdocs.io/javascript/global_objects/promise/race)
|
||||
- [devdocs.io/javascript/global_objects/promise/all](https://devdocs.io/javascript/global_objects/promise/all)
|
||||
|
||||
### Code provided
|
||||
|
||||
> all code provided will be added to your solution and doesn't need to be submited.
|
||||
> The provided code will be added to your solution, and does not need to be submitted.
|
||||
|
||||
```js
|
||||
// fake `getJSON` function
|
||||
let getJSON = async (url) => url
|
||||
```
|
||||
|
||||
### Notions
|
||||
|
||||
- [Promise.race](https://devdocs.io/javascript/global_objects/promise/race)
|
||||
- [Promise.all](https://devdocs.io/javascript/global_objects/promise/all)
|
||||
|
|
Loading…
Reference in New Issue