Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- public class EmployeeRouter {
- @Bean
- public RouterFunction<ServerResponse> route(EmployeeHandler handler) {
- return RouterFunctions.route(
- GET("/employees").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
- handler::getAllEmployees)
- .andRoute(
- GET("/employee/fn/{fn}/ln/{ln}")
- .and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
- handler::getEmployee)
- .andRoute(
- PUT("/employee").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
- handler::createNewEmployee)
- .andRoute(
- DELETE("/employee/id/{id}").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
- handler::deleteEmployee)
- .andRoute(
- GET("/departments").and(RequestPredicates.accept(MediaType.APPLICATION_JSON)),
- handler::getAllDepartments);
- }
- }
Add Comment
Please, Sign In to add comment