diff --git a/routes/api.php b/routes/api.php index b819a83..8c550d9 100644 --- a/routes/api.php +++ b/routes/api.php @@ -35,3 +35,75 @@ ], 500); } }); + + + + + +Route::get('/products', function () { + return response()->json([ + [ + 'id' => 1, + 'name' => 'CloudShopt Hoodie', + 'price' => 49.90, + 'currency' => 'EUR', + 'sku' => 'CS-HOODIE-001', + 'in_stock' => true, + ], + [ + 'id' => 2, + 'name' => 'CloudShopt T-Shirt', + 'price' => 19.90, + 'currency' => 'EUR', + 'sku' => 'CS-TSHIRT-001', + 'in_stock' => true, + ], + [ + 'id' => 3, + 'name' => 'CloudShopt Mug', + 'price' => 12.90, + 'currency' => 'EUR', + 'sku' => 'CS-MUG-001', + 'in_stock' => false, + ], + ]); +}); + + +Route::get('/products/{id}', function (string $id) { + $products = [ + 1 => [ + 'id' => 1, + 'name' => 'CloudShopt Hoodie', + 'price' => 49.90, + 'currency' => 'EUR', + 'sku' => 'CS-HOODIE-001', + 'in_stock' => true, + 'description' => 'Warm hoodie for cloud-native builders.', + ], + 2 => [ + 'id' => 2, + 'name' => 'CloudShopt T-Shirt', + 'price' => 19.90, + 'currency' => 'EUR', + 'sku' => 'CS-TSHIRT-001', + 'in_stock' => true, + 'description' => 'Soft cotton tee with CloudShopt logo.', + ], + 3 => [ + 'id' => 3, + 'name' => 'CloudShopt Mug', + 'price' => 12.90, + 'currency' => 'EUR', + 'sku' => 'CS-MUG-001', + 'in_stock' => false, + 'description' => 'Ceramic mug for your morning deploys.', + ], + ]; + + if (!isset($products[(int)$id])) { + return response()->json(['message' => 'Product not found'], 404); + } + + return response()->json($products[(int)$id]); +}); \ No newline at end of file