Class UserController

java.lang.Object
com.example.restapi.controller.UserController

@RestController @RequestMapping("/api/users") public class UserController extends Object
  • Field Details

  • Constructor Details

    • UserController

      @Autowired public UserController(UserService userService)
  • Method Details

    • getUserById

      @GetMapping("/{id}") public org.springframework.http.ResponseEntity<User> getUserById(@PathVariable Long id)
    • getUserByUsername

      @GetMapping("/{username}") public org.springframework.http.ResponseEntity<User> getUserByUsername(@PathVariable String username)
    • getAllUsers

      @GetMapping public List<User> getAllUsers()
    • createUser

      @PostMapping public org.springframework.http.ResponseEntity<User> createUser(@RequestBody User user)
    • register

      @PostMapping("/register") public org.springframework.http.ResponseEntity<?> register(@RequestBody User user)
    • login

      @PostMapping("/login") public org.springframework.http.ResponseEntity<?> login(@RequestBody User user, jakarta.servlet.http.HttpSession session)
    • checkSession

      @GetMapping("/session") public org.springframework.http.ResponseEntity<?> checkSession(jakarta.servlet.http.HttpSession session)
    • logout

      @PostMapping("/logout") public org.springframework.http.ResponseEntity<String> logout(jakarta.servlet.http.HttpSession session)
    • deleteUser

      @DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> deleteUser(@PathVariable Long id)