No Description

MovieController.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package fr.natan.akkastreamfileprocessingapi.controller;
  2. import fr.natan.akkastreamfileprocessingapi.service.AkkaStreamFileProcessing;
  3. import org.springframework.http.HttpStatus;
  4. import org.springframework.http.ResponseEntity;
  5. import org.springframework.web.bind.annotation.PathVariable;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestMethod;
  8. import org.springframework.web.bind.annotation.RestController;
  9. @RestController
  10. public class MovieController {
  11. private final AkkaStreamFileProcessing akkaStreamFilesProcessing;
  12. public MovieController(AkkaStreamFileProcessing akkaStreamFilesProcessing) {
  13. this.akkaStreamFilesProcessing = akkaStreamFilesProcessing;
  14. }
  15. @RequestMapping(value = "/movies", method = RequestMethod.GET)
  16. private ResponseEntity<String> getAllMovies() {
  17. akkaStreamFilesProcessing.getAllMovies();
  18. return new ResponseEntity<>("is running", HttpStatus.OK);
  19. }
  20. @RequestMapping(value = "/movies/{movieTitle}", method = RequestMethod.GET)
  21. private ResponseEntity<String> getMovieByTitle(@PathVariable(name ="movieTitle" ) String movieTitle){
  22. akkaStreamFilesProcessing.getMoviesByTitle(movieTitle);
  23. return new ResponseEntity<>("is running", HttpStatus.OK);
  24. }
  25. @RequestMapping(value = "/persons", method = RequestMethod.GET)
  26. private ResponseEntity<String> getallPersons(){
  27. akkaStreamFilesProcessing.getAllPersons();
  28. return new ResponseEntity<>("is running", HttpStatus.OK);
  29. }
  30. @RequestMapping(value = "/persons/{personID}", method = RequestMethod.GET)
  31. private ResponseEntity<String> getPersonByID(@PathVariable(name = "personID") String nconst){
  32. akkaStreamFilesProcessing.getPersonById(nconst);
  33. return new ResponseEntity<>("is running", HttpStatus.OK);
  34. }
  35. }

Powered by TurnKey Linux.