<file_sep>app.controller('ShowController', ['$scope', '$http', '$routeParams', '$location', function($scope, $http, $routeParams, $location) {
  console.log("Show controller.");
  $http.get('http://localhost:8080/api/swords/' + $routeParams.id).then(function(response) { // SHOW
    $scope.sword = response.data;
    console.log($scope.sword);
  }, function(response) {
    console.log("Invalid URL");
  });
}]);
<file_sep>app.controller('NewController', ["$scope", '$http', '$location', function($scope, $http, $location){
  console.log("New controller");
  $scope.addSword = function(sword){
    var sword = {
      swordName:  $scope.sword.swordName,
      swordOwner: $scope.sword.swordOwner
    }
    $http.post('http://localhost:8080/api/swords/', sword).then(function(response) { // NEW
      console.log("Sword added.");
      $location.path( "/" );
    }, function(response) {
      console.log("Invalid URL");
    });
  }
}]);
<file_sep>app.controller('HomeController', ['$scope', '$http', function($scope, $http){
  console.log("Home controller.");
  $http.get('http://localhost:8080/api/swords/').then(function(response) { // INDEX
    $scope.swords = response.data;
  }, function(response) {
    console.log("Invalid URL");
  });
}]);

$scope.deleteSword = function(sword) { // DESTROY
  console.log("Deleting sword.");
  $http.delete('http://localhost:8080/api/swords/' + sword._id).then(function(response){
    console.log("Sword deleted.");
    $route.reload();
  }, function(response) {
    console.log("Failed to reload page.");
  });
};
