add: createIngredients
This commit is contained in:
		
							
								
								
									
										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();
 | 
			
		||||
		Reference in New Issue
	
	Block a user