Last change
on this file since 3d60932 was 57e58a3, checked in by ste08 <sjovanoska@…>, 4 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
898 bytes
|
Line | |
---|
1 | package com.example.skychasemk.controller;
|
---|
2 |
|
---|
3 | import com.example.skychasemk.dto.ApplicationUserDTO;
|
---|
4 | import com.example.skychasemk.model.ApplicationUser;
|
---|
5 | import com.example.skychasemk.services.ApplicationUserService;
|
---|
6 | import jakarta.validation.Valid;
|
---|
7 | import org.springframework.beans.factory.annotation.Autowired;
|
---|
8 | import org.springframework.http.ResponseEntity;
|
---|
9 | import org.springframework.web.bind.annotation.*;
|
---|
10 |
|
---|
11 | @RestController
|
---|
12 | @RequestMapping("/api/user")
|
---|
13 | @CrossOrigin(origins = "http://localhost:5173") // Allow frontend access
|
---|
14 | public class ApplicationUserController {
|
---|
15 |
|
---|
16 | @Autowired
|
---|
17 | private ApplicationUserService userService;
|
---|
18 |
|
---|
19 | @PostMapping("/signup")
|
---|
20 | public ResponseEntity<String> registerUser(@Valid @RequestBody ApplicationUserDTO userDTO) {
|
---|
21 | ApplicationUser savedUser = userService.registerUser(userDTO);
|
---|
22 | return ResponseEntity.ok("User saved successfully");
|
---|
23 | }
|
---|
24 |
|
---|
25 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.