Last active
December 18, 2020 18:34
-
-
Save aytekin/e5d79fe26e75ed8c27f4e217bab6d7fd to your computer and use it in GitHub Desktop.
Swagger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping("api/product") | |
@AllArgsConstructor | |
public class ProductController { | |
private final ProductService productService; | |
@GetMapping("findAll") | |
public List<ProductDto> findAll() { | |
return productService.getProducts(); | |
} | |
@GetMapping("get") | |
public ProductDto get(Long id) throws ClassNotFoundException { | |
return productService.get(id); | |
} | |
@GetMapping("getByTitle") | |
public ProductDto getByTitle(String title) { | |
return productService.getByTitle(title); | |
} | |
@PostMapping | |
public Long save(@RequestBody ProductDto product) throws StackOverflowError, IllegalArgumentException { | |
return productService.save(product); | |
} | |
@DeleteMapping | |
public boolean delete(Long id) { | |
return productService.delete(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment