Skip to content

Latest commit

 

History

History
70 lines (60 loc) · 2.48 KB

a-more-realistic-application.md

File metadata and controls

70 lines (60 loc) · 2.48 KB

A More Realistic Application

Hello World is great, but it's not giving us the opportunity to really put into practise some of our functional programming ideas. To take things forward, we're going to be building a new microservice which uses our httpClient and logger from previous modules.

Exercises

  1. Create a microservice which will use the API provided by https://www.football-data.org to return all the fixtures in the upcoming World Cup (again, make it run on localhost:8000)
  2. Add logging to emit events detailing requests received and responses sent
  3. Add logic to remove the links to original API endpoints (_links property in each fixture) and replace them with IDs for the entities
  4. Explore using lenses for getting and setting properties on your fixture objects

Help

Example Fixture Object From Source API

{
   "result" : {
      "goalsAwayTeam" : null,
      "goalsHomeTeam" : null
   },
   "homeTeamName" : "Russia",
   "status" : "TIMED",
   "date" : "2018-06-14T15:00:00Z",
   "odds" : null,
   "matchday" : 1,
   "_links" : {
      "awayTeam" : {
         "href" : "http://api.football-data.org/v1/teams/801"
      },
      "homeTeam" : {
         "href" : "http://api.football-data.org/v1/teams/808"
      },
      "competition" : {
         "href" : "http://api.football-data.org/v1/competitions/467"
      },
      "self" : {
         "href" : "http://api.football-data.org/v1/fixtures/165069"
      }
   },
   "awayTeamName" : "Saudi Arabia"
}

Example Fixture Object From Our API

{
   "fixtureId" : "165069",
   "awayTeamId" : "801",
   "homeTeamName" : "Russia",
   "awayTeamName" : "Saudi Arabia",
   "status" : "TIMED",
   "date" : "2018-06-14T15:00:00.000Z",
   "result" : {
      "goalsHomeTeam" : null,
      "goalsAwayTeam" : null
   },
   "homeTeamId" : "808"
}

Further Reading

Next - process management