angular.module( 'moviematch.services', [] )

.factory( 'Auth', function( ) {} )

.factory( 'Session', function( ) {} )

.factory( 'Match', function( $http ) {
  return {
    sendVote: function( sessionID, userID, movieID, vote ) {
      return $http.post( // returns a promise; if you want to make use of a callback simply use .then on the return value.
        '/api/votes/recordvote', // expect this endpoint to take a json object
                                      // with sessionID and userID
                                      // OR sessionuserID
                                      // AND movieID
                                      // AND vote (boolean true/false where true is yes and false is no)
        { sessionID: sessionID, userID: userID, movieID: movieID, vote: vote })
      .then( function( response ) { // if the promise is resolved
        return response;
      },
      function( err ) { // if the promise is rejected
        console.error( err );
      } );
    }
  }
} );

angular.module( 'moviematch.services', [] )

.factory( 'Auth', function( ) {} )

.factory( 'Session', function( ) {} )

.factory( 'Match', function( $http ) {
  return {
    sendVote: function( sessionID, userID, movieID, vote ) {
      return $http.post( // returns a promise; if you want to make use of a callback simply use .then on the return value.
        '/api/votes', // expect this endpoint to take a json object
                                      // with sessionID and userID
                                      // OR sessionuserID
                                      // AND movieID
                                      // AND vote (boolean true/false where true is yes and false is no)
        { sessionID: sessionID, userID: userID, movieID: movieID, vote: vote })
      .then( function( response ) { // if the promise is resolved
        return response;
      },
      function( err ) { // if the promise is rejected
        console.error( err );
      } );
    }
  }
} );

Refactor API endpoint to match naming convention in server/config/routes.js
Refactor API endpoint to match naming convention in server/config/routes.js
