Creating the Category Service

The CategoryService objects is a singleton object because it is an AngularJS service. The service will interact with our CMS APIs powered by the Spring Boot application.

We will use the $http service. It makes the HTTP communications easier.

Let's write the CategoryService:

(function (angular) {  'use strict';  /* Services */</span>  angular.module('cms.modules.category.services', []).  service('CategoryService', ['$http',    function ($http) {      var serviceAddress = 'http://localhost:8080';      var urlCollections = serviceAddress + '/api/category';      var urlBase = serviceAddress + '/api/category/';      this.find = function () {        return $http.get(urlCollections);      };      this.findOne = function (id) {        return $http.get(urlBase + id)

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.