bebeboutik-api/routes/web.php
Christophe LATOUR c88ea57ba5 Initial commit
2017-07-21 16:40:11 +02:00

101 lines
3.2 KiB
PHP

<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$app->middleware([
Barryvdh\Cors\HandleCors::class,
]);
/** SWGGER DOCUMENTATION */
$app->get('/documentation', 'GeneratorController@index');
$app->post('/signup', 'AuthController@signup');
$app->post('/signout', 'AuthController@signout');
$app->post('/recover', 'AuthController@recover');
$app->group(['middleware' => 'auth'], function() use ($app) {
/*
|--------------------------------------------------------------------------
| AUTH ROUTES
|--------------------------------------------------------------------------
*/
$app->post('/signin', 'AuthController@signin');
/*
|--------------------------------------------------------------------------
| SALE ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/sales', 'SaleController@lists');
$app->get('/tags', 'TagController@lists');
/*
|--------------------------------------------------------------------------
| CATEGORY ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/category/{id_category}', 'CategoryController@get');
$app->get('/category/{id_category}/products', 'CategoryController@list_products');
/*
|--------------------------------------------------------------------------
| PRODUCT ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/product/{id_product}', 'ProductController@get');
/*
|--------------------------------------------------------------------------
| CART ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/cart', 'CartController@get');
/* CART CARRIERS */
$app->get('/cart/carriers', 'CartController@getCarriers');
$app->put('/cart/carrier', 'CartController@setCarrier');
/* CART PRODUCTS */
$app->put('/cart/product', 'CartController@addProduct');
$app->delete('/cart/product', 'CartController@removeProduct');
/* CART DISCOUNTS */
$app->put('/cart/discount', 'CartController@addDiscount');
/* CART ADDRESS */
$app->put('/cart/address', 'CartController@setAddress');
/*
|--------------------------------------------------------------------------
| USER ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/user', 'UserController@get');
$app->get('/user/discounts', 'DiscountController@lists');
$app->get('/user/discount/{id_discount}', 'DiscountController@get');
$app->get('/user/orders', 'OrderController@lists');
$app->get('/user/order/{id_order}', 'OrderController@get');
$app->get('/user/addresses', 'AddressController@lists');
$app->get('/user/address/{id_address}', 'AddressController@get');
$app->put('/user/address/{id_address}', 'AddressController@update');
$app->post('/user/address', 'AddressController@create');
$app->delete('/user/address/{id_address}', 'AddressController@delete');
});