Week 7, day 4

API, API, API. Oh and also SETUP, SETUP, SETUP.

We're quickly learning that setting up our framework is probably more challenging than writing tests and coding. I pity the poor soul that will depend on me to make the first commit.

This restart of the exercise will need to be finished at some point because we had quite ambitious plans for it, we want to make a Trumps style head-to-head multiplayer game and I'm pretty sure we can get there. Below is the horrid looking proof-of-concept showing that we can return the right data from our API calls.

GTG1

We've moved on to some hardcore Motion-View-Controller MVC implementations for our Angular exercises and it's quite some experience. Refactoring code at this stage is a scary and daunting prospect but we're left with no choice but to dive head-first right into it.

githubUserSearch.factory('Search', ['$http', function($http) {
  var queryUrl = 'https://api.github.com/search/users?access_token=PRIVATE';
  return {
    query: function(searchTerm) {
      return $http({
        url: queryUrl,
        method: 'GET',
        params: {
          'q': searchTerm
        }
      });
    }
  }
}]);

A first version of our factory object.

Written on April 30, 2015