diff options
Diffstat (limited to 'src/main/java/com/encora/Main.java')
-rw-r--r-- | src/main/java/com/encora/Main.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/main/java/com/encora/Main.java b/src/main/java/com/encora/Main.java index 7591eed..2989919 100644 --- a/src/main/java/com/encora/Main.java +++ b/src/main/java/com/encora/Main.java @@ -3,17 +3,28 @@ package com.encora; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; + +import java.util.List; @SpringBootApplication @RestController +@RequestMapping("v1") public class Main { + private final ToDosRepository toDosRepository; + + public Main(ToDosRepository toDosRepository) { + this.toDosRepository = toDosRepository; + } + public Main() { + this.toDosRepository = new ToDosRepository(); + } + public static void main(String[] args) { SpringApplication.run(Main.class, args); } - @GetMapping("/greet") - public String greet() { - return "Hello world!"; + @GetMapping("/todos") + public List<ToDos> getToDos() { + return toDosRepository.findAll(); } } |