MovieController
package dev.harsh.movies;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.util.List;
@RestController
@RequestMapping("api/v1/movies")
public class MovieController {
@Autowired
private MovieService movieService;
@GetMapping
public ResponseEntity<List<Movie>> allMovies(){
return new ResponseEntity<List<Movie>>(movieService.allMovies(), HttpStatus.OK);
}
}