add: createIngredients

This commit is contained in:
Don Bock 2023-01-19 14:27:30 +01:00
parent e666991b60
commit 7c4ab54f45

View File

@ -58,4 +58,14 @@ $app->post("/login", function( array $req, Response $res) use ($db) {
} }
}); });
$app->post("/createingredients", function (array $req, Response $res) use ($db) {
$newIngredient = $req["body"]["ingredient"];
$newCalorie = $req["body"]["calories"];
$newWeight = $req["body"]["weight"];
$newPrice = $req["body"]["price"];
$db->insert("ingredienti", ["cognome" => "$newIngredient", "caloriePerCento" => "$newCalorie", "ilPeso" => "$newWeight", "prezzo" => "$newPrice"]);
$res->send("New ingredient has been listed ");
});
$app->start(); $app->start();