Skip to content

Commit 0ae3c3e

Browse files
committed
Add API routes
1 parent 90775e4 commit 0ae3c3e

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

routes/api.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<?php
22

3-
use Illuminate\Http\Request;
3+
// use Illuminate\Http\Request;
44
use Illuminate\Support\Facades\Route;
55

6-
/*
7-
|--------------------------------------------------------------------------
8-
| API Routes
9-
|--------------------------------------------------------------------------
10-
|
11-
| Here is where you can register API routes for your application. These
12-
| routes are loaded by the RouteServiceProvider within a group which
13-
| is assigned the "api" middleware group. Enjoy building your API!
14-
|
15-
*/
6+
use App\Http\Controllers\Api\CategoryController;
7+
use App\Http\Controllers\Api\ProductController;
8+
use App\Http\Controllers\Api\UserController;
169

17-
Route::middleware('auth:api')->get('/user', function (Request $request) {
18-
return $request->user();
19-
});
10+
Route::get('/categories', [CategoryController::class, 'index']);
11+
Route::get('/categories/{category}', [CategoryController::class, 'show']);
12+
13+
Route::get('/products', [ProductController::class, 'index']);
14+
Route::get('/products/{product}', [ProductController::class, 'show']);
15+
16+
Route::post('/purchase', [UserController::class, 'purchase']);

0 commit comments

Comments
 (0)