basic api functuinality added, still needs debugging

This commit is contained in:
Bruno
2022-06-17 13:05:00 +02:00
parent ebfd1b78e5
commit 5e86c05ca8
4 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package whattocook.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import whattocook.repositories.ItemRepository;
import whattocook.implementation.ApiServiceImpl;
import java.io.IOException;
@Controller
public class SpoonacularController {
private final int nextPages = 10;
@Autowired
private ItemRepository itemRepository;
@Autowired
private ApiServiceImpl service;
@GetMapping("api/forFridge")
public HttpEntity<String> getForFridge() throws IOException, InterruptedException {
return new HttpEntity<>(service.getForIngridients(itemRepository.findAll(), 10));
}
}