Guest User

Untitled

a guest
Jun 25th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. @Configuration
  2. public class EmployeeRouter {
  3. @Bean
  4. public RouterFunction<ServerResponse> route(EmployeeHandler handler) {
  5. return RouterFunctions.route(
  6. GET("/employees").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
  7. handler::getAllEmployees)
  8. .andRoute(
  9. GET("/employee/fn/{fn}/ln/{ln}")
  10. .and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
  11. handler::getEmployee)
  12. .andRoute(
  13. PUT("/employee").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
  14. handler::createNewEmployee)
  15. .andRoute(
  16. DELETE("/employee/id/{id}").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
  17. handler::deleteEmployee)
  18. .andRoute(
  19. GET("/departments").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
  20. handler::getAllDepartments);
  21. }
  22. }
Add Comment
Please, Sign In to add comment