diff --git a/backend/src/main/whattocook/controller/SpoonacularController.java b/backend/src/main/whattocook/controller/SpoonacularController.java index ea63e9d..8fe7fb6 100644 --- a/backend/src/main/whattocook/controller/SpoonacularController.java +++ b/backend/src/main/whattocook/controller/SpoonacularController.java @@ -2,8 +2,8 @@ package whattocook.controller; import org.json.JSONException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.rest.webmvc.BasePathAwareController; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import spoonaccular.RecipeInformation; import spoonaccular.RecipeSearch; @@ -16,7 +16,7 @@ import java.util.LinkedList; import java.util.List; @RestController() -@RequestMapping(path = "recipe") +@BasePathAwareController() public class SpoonacularController { private int nextRecepies=10; private int nextRecepiesForOneRandom=20; @@ -27,18 +27,18 @@ public class SpoonacularController { @Autowired private RecipeSearch recipeSearch; - @GetMapping("/forFridge") + @GetMapping("/recipe/forFridge") public List getForFridge() throws IOException { return recipeSearch.getForIngridients(itemRepository.findAll(), nextRecepies); } - @GetMapping("/random") + @GetMapping("/recipe/random") public List getRandom() throws IOException, InterruptedException, JSONException { return recipeSearch.getRandom(new LinkedList<>(), nextRecepies); //when user has food preferences apply instead of linked list. } - @GetMapping("/oneFridge") + @GetMapping("/recipe/oneFridge") public ExtendedRecipeByIngredient getOneFridge() throws IOException { return recipeSearch.getOneForIngridients(itemRepository.findAll(), nextRecepiesForOneRandom); }