<?php

use Illuminate\Routing\Router;

Route::group([
    'domain'     => config('api.route.domain'),
    'prefix'     => config('api.route.prefix'),
    'namespace'  => config('api.route.namespace'),
    'middleware' => config('api.route.middleware'),
], function (Router $router) {
    $router->get('auth/license', 'AuthController@license');
    $router->post('auth/code/login', 'AuthController@code');
    $router->post('auth/code/login2', 'AuthController@code2');
    $router->post('auth/loginByCode', 'AuthController@loginByCode');
});

Route::group([
    'domain'     => config('api.route.domain'),
    'prefix'     => config('api.route.prefix'),
    'namespace'  => config('api.route.namespace'),
    'middleware' => config('api.route.middleware_auth'),
], function (Router $router) {
    $router->get('index', 'IndexController@index');
    $router->get('agent', 'IndexController@agent');
    $router->post('sign', 'IndexController@sign');

    $router->get('vote', 'VoteController@index');
    $router->get('vote/{vote}', 'VoteController@show');
    $router->post('vote/{vote}', 'VoteController@submit');
    $router->get('articles', 'ArticleController@index');
    $router->get('articles/{article}', 'ArticleController@show');
    $router->post('articles/{article}', 'ArticleController@audit');
});
