File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/main/java/com/jap/rest101/controller Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .jap .rest101 .controller ;
2+
3+ import com .jap .rest101 .db .entity .User ;
4+ import com .jap .rest101 .db .repository .UserRepository ;
5+ import lombok .RequiredArgsConstructor ;
6+ import org .springframework .http .ResponseEntity ;
7+ import org .springframework .web .bind .annotation .PostMapping ;
8+ import org .springframework .web .bind .annotation .RequestBody ;
9+ import org .springframework .web .bind .annotation .RequestMapping ;
10+ import org .springframework .web .bind .annotation .RestController ;
11+
12+ @ RestController
13+ @ RequestMapping ("/users" )
14+ @ RequiredArgsConstructor
15+ public class UserController {
16+
17+ private final UserRepository repository ;
18+
19+ @ PostMapping
20+ public ResponseEntity <User > createUser (@ RequestBody User user ) {
21+ repository .save (user );
22+ return ResponseEntity .ok (user );
23+ }
24+ }
25+
You can’t perform that action at this time.
0 commit comments