Example #1
0
    $recette = Recette::getRecetteByName($nomRecette);
});
$app->get('/getRecetteByComplexite/:complexite/:userId', function ($complexite, $userId) {
    //renvoi les recettes avec une complexité < ou =
    $recette = Recette::getRecetteByComplexite($complexite, $userId);
});
$app->get('/getRecetteByNote/:note/:userId', function ($note, $userId) {
    //renvoi les recettes avec une note > ou =
    $recette = Recette::getRecetteByNote($note, $userId);
});
$app->get('/getRecetteByTemps/:temps/:userId', function ($temps, $userId) {
    //renvoi les recettes avec un temps < ou =
    $recette = Recette::getRecetteByTemps($temps, $userId);
});
$app->get('/getRecetteByAll/:complexite/:note/:temps/:userId/:nbPersonne', function ($complexite, $note, $temps, $userId, $nbPersonne) {
    $recette = Recette::getRecetteByAll($complexite, $note, $temps, $userId, $nbPersonne);
});
$app->get('/getAllRecette/:userId', function ($userId) {
    //renvoi toutes les recettes
    $recette = Recette::getAllRecette($userId);
});
$app->get('/getPourcentageIngredient/:recetteId/:userId', function ($recetteId, $userId) {
    //renvoi le pourcentage de recette
    $recette = Recette::getPourcentageIngredient($recetteId, $userId);
});
$app->post('/addRecette', function () {
    //Ajoute une recette
    $recette = Recette::addRecette($_POST['nomRecette'], $_POST['complexite'], $_POST['note'], $_POST['temps'], $_POST['nbPersonne'], $_POST['description']);
});
$app->post('/addRecette_ingr', function () {
    //Ajoute une recette