lundi 23 juillet 2018

any ideas solve iterator implementation?

some one give me an ideas for the coding challenge: - The task is to write an iterator which polls a number of external services and if a certain criterion is met, redirects the user elsewhere.

From the user's perspective, the experience is as follows:

  • user arrives to the site,
  • clicks a button,
  • sees a loader,
  • and is redirected to another page.

From the technical perspective, the flow follows a similar pattern:

  • user arrives to the site,
  • front end makes a request to the first service,
  • the first service responds with the url of the second service and instructs to make an XHR request, 4. front end makes a request to the second service,
  • 3-4 are repeated n times
  • the (n+1)th service responds with the next url and instructs to redirect the user to the page

Spec Example of backend service responses including the next request's URL and what to do with it:

GET / (Response instructing an XHR request)

    {
    "activity": "xhr"
    "activity_url": "http://example.com/xhr_endpoint"
    }

GET / (Response instructing a redirect)

    {
    "activity": "redirect",
    "activity_url": "http://example.com/landing_page"
    }

  • The first activity url should be predefined (offer_url).

  • The "activity_url" param is sent to you encoded using base64 URL-safe alphabet.

so can any one help me for writing that iterator ?




Aucun commentaire:

Enregistrer un commentaire