package sklep.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.time.LocalDateTime;

@Controller
public class RootController {
    @GetMapping("/")
    @ResponseBody
    public String root() {
        return "Hello! Aplikacja sklep";
    }

    @GetMapping("/time")
    public String currentTime(Model model) {
        LocalDateTime now = LocalDateTime.now();
        model.addAttribute("dt", now);
        return "show_time.jsp";
    }

}
