Last active
July 28, 2020 08:13
-
-
Save iamvickyav/08c1d6f9e5d9e611f3eed863d7be130f 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
public class User { | |
private Integer id; | |
private String name; | |
private Date dob; | |
private String city; | |
// constructors, getters & setters are ignored | |
} | |
@RestController | |
public class UserController { | |
@Autowired | |
UserService userService; | |
@RequestMapping(value = "/user/{name}", method= RequestMethod.GET) | |
User getUserByName(@PathVariable("name") String name){ | |
return userService.getUser(name); | |
} | |
@RequestMapping(value = "/users", method= RequestMethod.GET) | |
List<User> getAllUsers(){ | |
return userService.getAllUsers(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment