March 2018
Intermediate to advanced
380 pages
9h 23m
English
In the src/main/java/com/mycompany/store/web/rest folder you will find the entity resource service. Open ProductResource.java:
@RestController@RequestMapping("/api")public class ProductResource { ...}
The resource acts as the controller layer and in our case, it serves the REST endpoints to be used by our client-side code. The endpoint has a base mapping to "/api":
@GetMapping("/products") @Timed public ResponseEntity<List<Product>> getAllProducts(Pageable pageable) { log.debug("REST request to get a page of Products"); Page<Product> page = productService.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/products"); return new ResponseEntity<>(page.getContent(), ...