meh
This commit is contained in:
parent
3bfb8349a5
commit
0d76bbfe14
17
src/main/java/com/example/demo/Recipe.java
Normal file
17
src/main/java/com/example/demo/Recipe.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recipe
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Recipe {
|
||||||
|
private UUID id;
|
||||||
|
private String name;
|
||||||
|
private ArrayList<String> ingredients;
|
||||||
|
private String instructions;
|
||||||
|
}
|
||||||
41
src/main/java/com/example/demo/RecipeController.java
Normal file
41
src/main/java/com/example/demo/RecipeController.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HelloController
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class RecipeController {
|
||||||
|
|
||||||
|
@GetMapping("/recipe")
|
||||||
|
public List<Recipe> getRecipes() {
|
||||||
|
Recipe recipe = new Recipe();
|
||||||
|
recipe.setId(UUID.randomUUID());
|
||||||
|
recipe.setName("mlem");
|
||||||
|
recipe.setIngredients(new ArrayList<String>());
|
||||||
|
recipe.getIngredients().add("test");
|
||||||
|
recipe.setInstructions("blepo");
|
||||||
|
// retournes toutes les recettes
|
||||||
|
ArrayList<Recipe> recipes = new ArrayList<Recipe>();
|
||||||
|
recipes.add(recipe);
|
||||||
|
return recipes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/recipe/{uuid}")
|
||||||
|
public Recipe getRecipe() {
|
||||||
|
// retourne une recette
|
||||||
|
Recipe recipe = new Recipe();
|
||||||
|
recipe.setId(UUID.randomUUID());
|
||||||
|
recipe.setName("mlem");
|
||||||
|
recipe.setIngredients(new ArrayList<String>());
|
||||||
|
recipe.setInstructions("blepo");
|
||||||
|
return recipe;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user