Getting one user by ID

Find the code snippet for the getAllUserByID() operation:

//    Getting one User by ID
@GetMapping(path = ["/user/{id}"])
fun getAllUserByID(@PathVariable("id") id: Int): ResponseEntity<UserModel> {
return ResponseEntity(userService.getUserByID(id),
HttpStatus.OK)
}

The @GetMapping(path = ["/user/{id}"]) annotation is the URL path of "/user/{id}", and it is a GET request with a specific ID. Here, we will get the specific user details from the database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.2.225