add: createIngredients
This commit is contained in:
parent
e666991b60
commit
7c4ab54f45
10
index.php
10
index.php
@ -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();
|
Loading…
Reference in New Issue
Block a user