I am using Spring Boot to define a REST-Api. I am looking for a way to declare a handler that will return a JSON-file.
Here is my idea:
In order to return a HTML-file, this file needs to be located inside resources --> templates
.
By defining a controller such as the following:
@Controller
public class LoginController {
@GetMapping("/home")
public String home() {
return "home";
}
and including the thymeleaf-dependency inside your Maven pom.xml, the HTML-file can be returned upon referencing domainname/home.
The same should be true for returning a JSON-file, but I don't know where to store this file. Is it suppossed to go inside templates as well?