49. User registration - Register User Endpoint (#4)
This commit is contained in:
@ -1,15 +1,24 @@
|
|||||||
package net.shyshkin.study.fullstack.supportportal.backend.controller;
|
package net.shyshkin.study.fullstack.supportportal.backend.controller;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import net.shyshkin.study.fullstack.supportportal.backend.domain.User;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import net.shyshkin.study.fullstack.supportportal.backend.service.UserService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("user")
|
@RequestMapping("user")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class UserResource {
|
public class UserResource {
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
@GetMapping("home")
|
@GetMapping("home")
|
||||||
public String showUser() {
|
public String showUser() {
|
||||||
return "Application works";
|
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