49. User registration - Register User Endpoint (#4)
This commit is contained in:
@ -1,15 +1,24 @@
|
||||
package net.shyshkin.study.fullstack.supportportal.backend.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.domain.User;
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.service.UserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("user")
|
||||
@RequiredArgsConstructor
|
||||
public class UserResource {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
@GetMapping("home")
|
||||
public String showUser() {
|
||||
return "Application works";
|
||||
}
|
||||
|
||||
@PostMapping("register")
|
||||
public User register(@RequestBody User user) {
|
||||
return userService.register(user.getFirstName(), user.getLastName(), user.getUsername(), user.getEmail());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user