Commit 73a26765 by Patryk Czarnik

currentTime jako @ResponseBody

parent 42ab09b6
...@@ -4,6 +4,8 @@ import org.springframework.stereotype.Controller; ...@@ -4,6 +4,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.time.LocalDateTime;
@Controller @Controller
public class RootController { public class RootController {
@GetMapping("/") @GetMapping("/")
...@@ -11,4 +13,12 @@ public class RootController { ...@@ -11,4 +13,12 @@ public class RootController {
public String root() { public String root() {
return "Hello! Aplikacja sklep"; return "Hello! Aplikacja sklep";
} }
@GetMapping("/time")
@ResponseBody
public String currentTime() {
LocalDateTime now = LocalDateTime.now();
return now.toString();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment