-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.php
37 lines (26 loc) · 1.39 KB
/
routes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
use MiladRahimi\PhpRouter\Router;
use Api\V1\Controllers\ListingController;
use Api\V1\Controllers\UserController;
use Api\V1\Controllers\AuthController;
use Api\V1\Middlewares\AuthMiddleware;
use Api\V1\Controllers\PaymentController;
$router = Router::create();
$router->get('/', [ListingController::class, 'index']); //should eventually be login url or something
$router->group(['middleware' => [AuthMiddleware::class]], function(Router $router) {
$router->get('/listings', [ListingController::class, 'index']);
$router->get('/listings/{id}', [ListingController::class, 'show']);
$router->post('/listings', [ListingController::class, 'create']);
$router->patch('/listings/{id}', [ListingController::class, 'update']);
$router->delete('/listings/{id}', [ListingController::class, 'destroy']);
$router->get('/users', [UserController::class, 'index']);
$router->get('/users/{id}', [UserController::class, 'show']);
$router->patch('/users/{id}', [UserController::class, 'update']);
$router->delete('/users/{id}', [UserController::class, 'destroy']);
$router->post('/pay/listing/{listing_id}', [PaymentController::class, 'pay']);
$router->get('/logout', [AuthController::class, 'logout']);
});
$router->get('/pay_redirect', [PaymentController::class, 'pay_redirect']);
$router->post('/users', [UserController::class, 'create']);
$router->post('/login', [AuthController::class, 'login']);
$router->dispatch();