use $resource instead of $http