January 2020
Intermediate to advanced
428 pages
10h 34m
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") 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( ServletUriComponentsBuilder.fromCurrentRequest(), page); return ResponseEntity.ok().headers(headers). ...Read now
Unlock full access