- user arrives to the site,
- clicks a button,
- sees a loader,
- and is redirected to another page.
- 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
As the idea is simple i preferd not using any MVC frameworks all done this plain javascript. i created 4 service json files in this formate as provided in spec and i added small fields for data visualization:-
{
"id":" ",
"activity": "xhr",
"activity_url": "Url for next services",
"name":"Name of service",
"description":"service description",
"img":"service image"
}
and the last service json format, which is responsible for redirecting after service end, like this provides also on spec:-
{
"id":" ",
"activity": "redirect",
"activity_url": "http://example.com/landing_page"
}
I host this service on cloud site. i using simple ajax calling which it will recursively and automatically call the next servive until redirecting
- git clone the repository via
git clone repository name
and install dependances vianpm install
- start the server via
npm start
- open browser on port 4444
I add a simple test cases using Mocha with Chai and sinon for spy stuff , i focus testing on successful API call, is it call successfully and with appropriate response or fail to run test just type npm test
and also listen on port 4444
I Deploy the app on firebase and you can just see the app from this link Fortumo Task