get user api
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.example.restfulwebservice.user;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class UserController {
|
||||
private final UserDaoService userDaoService;
|
||||
|
||||
public UserController(UserDaoService userDaoService) {
|
||||
this.userDaoService = userDaoService;
|
||||
}
|
||||
|
||||
@GetMapping("/users")
|
||||
public List<User> retrieveAllUsers() {
|
||||
return userDaoService.findAll();
|
||||
}
|
||||
|
||||
@GetMapping("/users/{id}")
|
||||
public User retrieveUser(@PathVariable int id) {
|
||||
return userDaoService.findOne(id);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user