-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReviewController.java
More file actions
24 lines (18 loc) · 859 Bytes
/
Copy pathReviewController.java
File metadata and controls
24 lines (18 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.example.moviesweb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/api/reviews")
public class ReviewController {
@Autowired
private ReviewService reviewService;
private ResponseEntity<Review> createReview(@RequestBody Map<String,String> payload){
return new ResponseEntity<Review>(reviewService.createReview(payload.get("reviewBody"),payload.get("imdbId")), HttpStatus.CREATED);
}
}