I was told I'm using factories wrong, but I'm not so sure. Any ideas? (I know I should be using GET; I've only just noticed that)app.factory('apiFactory', ['$http', function($http){    var apiFactory = {};    apiFactory.initUser = function(){        return  $http({            method: POST,            url: api/new_user.php,            headers: {Content-Type: application/x-www-form-urlencoded}        });    };    apiFactory.hostOrClient = function(session){        return $http({            method: POST,            url: api/sessionhostclient.php,            data: $.param({session:session}),            headers:{Content-Type: application/x-www-form-urlencoded}        });    };    apiFactory.hasPlayerJoined = function(session){        return $http({            method: POST,            url: api/sessionstatus.php,            data: $.param({session:session}),            headers: {Content-Type: application/x-www-form-urlencoded}        });    };    apiFactory.sendMessage = function(session, message){        return $http({            method: POST,            url: api/addmessage.php,            data: $.param({message:message, session:session}),            headers: {Content-Type: application/x-www-form-urlencoded}        });    };    apiFactory.checkMessages = function(session, id){        return $http({            method: POST,            url: api/getmessages.php,            data: $.param({session:session, id:id}),            headers: {Content-Type: application/x-www-form-urlencoded}        });    };    apiFactory.getAllMessages = function(session) {        if(session == null){            return;        }        return $http({            method:POST,            url:api/getallmessages.php,            data: $.param({session:session}),            headers:{Content-Type: application/x-www-form-urlencoded}        });    } ;    apiFactory.getMessagesFrom = function(session, id){        return $http({            method: POST,            url: api/getmessages.php,            data: $.param({session:session, id:id}),            headers: {Content-Type: application/x-www-form-urlencoded}        });    };    return apiFactory;}]);
API factory for a realtime chat site
javascript;angular.js