You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Aamsua 225a9325ff
Update README.md
2 years ago
..
README.md Update README.md 2 years ago

README.md

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

queryServers('pouet', 'hello+world')
// return the fastest of those 2 calls:
// -> getJSON('/pouet?q=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'.

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.

Notions

Code provided

all code provided will be added to your solution and doesn't need to be submited.

// fake `getJSON` function
let getJSON = async (url) => url