12345678910111213141516171819202122232425262728293031323334 |
- <?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.
- |
- */
- $api = app('Dingo\Api\Routing\Router');
- $api->version('v1', [
- 'namespace' => 'App\Http\Controllers',
- ], function ($api) {
- //登录
- $api->post('login', 'AuthController@authenticate');
- $api->group(['middleware' => 'auth:api'], function ($api) {
- //注册
- $api->post('reg', 'AuthController@register');
- //登出
- $api->post('logout', 'AuthController@logout');
- //刷新身份令牌
- $api->post('refresh', 'AuthController@refresh');
- });
- $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
- $api->get('user', 'UserController@index');
- });
- });
|