Deleting a user 

Find the code snippet for deleteUser() operation:

//    Deleting a User
@DeleteMapping(path = ["/user/{id}"])
fun deleteUser(@PathVariable("id") id: Int): String {
userService.deleteUser(id)
return "$id User has been deleted."
}

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

If you finish this controller class, then you are ready to run this application and test the REST API using Insomnia.

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

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