Last active
February 8, 2018 06:55
-
-
Save rinormaloku/bf946a4a52d5172312f17450234d4192 to your computer and use it in GitHub Desktop.
[Sentiment Controller in Spring WebApp] Sentiment controller that takes requests from React #spring #controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@CrossOrigin(origins = "*") | |
@RestController | |
public class SentimentController { | |
@Value("${sa.logic.api.url}") // #1 | |
private String saLogicApiUrl; | |
@PostMapping("/sentiment") | |
public SentimentDto sentimentAnalysis(@RequestBody SentenceDto sentenceDto) { | |
RestTemplate restTemplate = new RestTemplate(); | |
return restTemplate.postForEntity(saLogicApiUrl + "/analyse/sentiment", // #2 | |
sentenceDto, SentimentDto.class) | |
.getBody(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment