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(), headers,
HttpStatus.OK);
}
All the CRUD actions have equivalent mapping methods here, for example, the getAllProducts maps to the findAll from our service. The resource also handles pagination by adding appropriate headers for pagination.