Last active
November 2, 2019 21:32
-
-
Save auryn31/2cef4ea2d5b5cb74f7583127ee3d74d3 to your computer and use it in GitHub Desktop.
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
@GetMapping("/users/{id}") | |
fun specificUser(@PathVariable id: Int): ResponseEntity<EntityModel<User>> { | |
if(dataBean.users.filter { it.id == id }.isEmpty()){ | |
return ResponseEntity(HttpStatus.NOT_FOUND) | |
} | |
return ResponseEntity(EntityModel(dataBean.users.filter { it.id == id }.first(), | |
linkTo(methodOn(UserController::class.java).specificUser(id)).withSelfRel(), | |
linkTo(methodOn(UserController::class.java).allUsers()).withRel("users")), HttpStatus.OK) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment