diff --git a/pom.xml b/pom.xml index 316fcab9..27326777 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,12 @@ - 4.0.0 org.springframework.boot spring-boot-starter-parent - 2.2.4.RELEASE - + 3.3.0 + br.ce.wcaquino tasks-frontend @@ -15,11 +14,9 @@ war tasks-frontend A very simple task management tool - - 1.8 + 21 - org.springframework.boot diff --git a/src/main/java/br/ce/wcaquino/tasksfrontend/ServletInitializer.java b/src/main/java/br/ce/wcaquino/tasksfrontend/ServletInitializer.java deleted file mode 100644 index e4ee136c..00000000 --- a/src/main/java/br/ce/wcaquino/tasksfrontend/ServletInitializer.java +++ /dev/null @@ -1,13 +0,0 @@ -package br.ce.wcaquino.tasksfrontend; - -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; - -public class ServletInitializer extends SpringBootServletInitializer { - - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(TasksFrontendApplication.class); - } - -} diff --git a/src/main/java/br/ce/wcaquino/tasksfrontend/controller/TasksController.java b/src/main/java/br/ce/wcaquino/tasksfrontend/controller/TasksController.java index e1fa5feb..7abe7b90 100644 --- a/src/main/java/br/ce/wcaquino/tasksfrontend/controller/TasksController.java +++ b/src/main/java/br/ce/wcaquino/tasksfrontend/controller/TasksController.java @@ -1,4 +1,4 @@ -package br.ce.wcaquino.tasksfrontend.controller; +package br.ce.wcaquino.tasksfrontend.controller; import java.util.List; import java.util.regex.Matcher; @@ -27,7 +27,7 @@ public class TasksController { private String VERSION; public String getBackendURL() { - return "http://" + BACKEND_HOST + ":" + BACKEND_PORT; + return "http://" + BACKEND_HOST + ":" + BACKEND_PORT + "/tasks-backend"; } @GetMapping("") @@ -49,8 +49,8 @@ public String save(Todo todo, Model model) { try { RestTemplate restTemplate = new RestTemplate(); restTemplate.postForObject( - getBackendURL() + "/tasks-backend/todo", todo, Object.class); - model.addAttribute("sucess", "Sucess!"); + getBackendURL() + "/todo", todo, Object.class); + model.addAttribute("success", "Success!"); return "index"; } catch(Exception e) { Pattern compile = Pattern.compile("message\":\"(.*)\","); @@ -67,7 +67,7 @@ public String save(Todo todo, Model model) { @GetMapping("delete/{id}") public String delete(@PathVariable Long id, Model model) { RestTemplate restTemplate = new RestTemplate(); - restTemplate.delete(getBackendURL() + "/tasks-backend/todo/" + id); + restTemplate.delete(getBackendURL() + "/todo/" + id); model.addAttribute("success", "Success!"); model.addAttribute("todos", getTodos()); return "index"; @@ -78,6 +78,6 @@ public String delete(@PathVariable Long id, Model model) { private List getTodos() { RestTemplate restTemplate = new RestTemplate(); return restTemplate.getForObject( - getBackendURL() + "/tasks-backend/todo", List.class); + getBackendURL() + "/todo", List.class); } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0f5790e5..d71bb510 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,5 @@ server.port=8002 +spring.application.name=tasks-frontend backend.host=${BACKEND_HOST:127.0.0.1} backend.port=${BACKEND_PORT:8001} diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 67eec394..c20ee563 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -12,7 +12,7 @@

Tasks

A very simple task management tool

-

No tasks... enjoy your day!