26 lines
710 B
Java
26 lines
710 B
Java
package myapi.api.Controller;
|
|
|
|
import java.util.List;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import myapi.api.Data.Repository.TaskRepository;
|
|
import myapi.api.Model.Task;
|
|
|
|
@RestController
|
|
@RequestMapping("/task")
|
|
public class TaskController {
|
|
private final TaskRepository taskRepository;
|
|
|
|
public TaskController(TaskRepository repository){
|
|
this.taskRepository = repository;
|
|
}
|
|
|
|
@GetMapping
|
|
public List<Task> getTasks(){
|
|
return this.taskRepository.findAll();
|
|
}
|
|
} |