Commit 9620656e by Patryk Czarnik

Pobierz czas i inne proste przykłady

parent 4a4d34d7
package com.example.demo; package com.example.demo;
import java.time.LocalDateTime;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -7,10 +9,23 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -7,10 +9,23 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller @Controller
public class PierwszyController { public class PierwszyController {
@RequestMapping("/")
@ResponseBody
public String index() {
return "Aplikacja springowa";
}
@RequestMapping("/hello") @RequestMapping("/hello")
@ResponseBody @ResponseBody
public String hello() { public String hello() {
return "Hello world"; return "Hello world";
} }
// Dodaj metodę wyświetlającą bieżący czas
@RequestMapping("/czas")
@ResponseBody
public LocalDateTime czas() {
return LocalDateTime.now();
}
} }
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