HummingBirdAnimeClient/app/appConf/routes.php

210 lines
5.0 KiB
PHP
Raw Normal View History

2017-02-15 16:13:32 -05:00
<?php declare(strict_types=1);
2015-11-16 11:40:01 -05:00
/**
2017-02-15 16:13:32 -05:00
* Hummingbird Anime List Client
2015-11-16 11:40:01 -05:00
*
2017-02-15 16:13:32 -05:00
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
2015-11-16 11:40:01 -05:00
*
2017-02-15 16:13:32 -05:00
* PHP version 7
2016-08-30 10:01:18 -04:00
*
2015-11-16 11:40:01 -05:00
* @package HummingbirdAnimeClient
2016-08-30 10:01:18 -04:00
* @author Timothy J. Warren <tim@timshomepage.net>
2017-02-15 16:13:32 -05:00
* @copyright 2015 - 2017 Timothy J. Warren
2016-08-30 10:01:18 -04:00
* @license http://www.opensource.org/licenses/mit-license.html MIT License
2017-02-15 16:13:32 -05:00
* @version 4.0
2015-11-16 11:40:01 -05:00
* @link https://github.com/timw4mail/HummingBirdAnimeClient
*/
2015-05-22 12:36:26 -04:00
2017-02-15 16:13:32 -05:00
use const Aviat\AnimeClient\{
DEFAULT_CONTROLLER_METHOD,
DEFAULT_CONTROLLER_NAMESPACE
};
2016-01-06 11:08:56 -05:00
use Aviat\AnimeClient\AnimeClient;
2017-03-30 16:16:40 -04:00
// -------------------------------------------------------------------------
// Routing Config
//
// Maps paths to controlers and methods
// -------------------------------------------------------------------------
2015-05-22 12:36:26 -04:00
return [
2017-03-30 16:16:40 -04:00
// ---------------------------------------------------------------------
// Anime List Routes
// ---------------------------------------------------------------------
'anime.add.get' => [
'path' => '/anime/add',
'action' => 'addForm',
'verb' => 'get',
],
'anime.add.post' => [
'path' => '/anime/add',
'action' => 'add',
'verb' => 'post',
],
'anime.details' => [
'path' => '/anime/details/{id}',
'action' => 'details',
'tokens' => [
'id' => '[a-z0-9\-]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'anime.delete' => [
'path' => '/anime/delete',
'action' => 'delete',
'verb' => 'post',
],
// ---------------------------------------------------------------------
// Manga Routes
// ---------------------------------------------------------------------
'manga.search' => [
'path' => '/manga/search',
'action' => 'search',
],
'manga.add.get' => [
'path' => '/manga/add',
'action' => 'addForm',
'verb' => 'get',
],
'manga.add.post' => [
'path' => '/manga/add',
'action' => 'add',
'verb' => 'post',
],
'manga.delete' => [
'path' => '/manga/delete',
'action' => 'delete',
'verb' => 'post',
],
'manga.details' => [
'path' => '/manga/details/{id}',
'action' => 'details',
'tokens' => [
'id' => '[a-z0-9\-]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
// ---------------------------------------------------------------------
// Anime Collection Routes
// ---------------------------------------------------------------------
'collection.search' => [
'path' => '/collection/search',
'action' => 'search',
],
'collection.add.get' => [
'path' => '/collection/add',
'action' => 'form',
'params' => [],
],
'collection.edit.get' => [
'path' => '/collection/edit/{id}',
'action' => 'form',
'tokens' => [
'id' => '[0-9]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'collection.add.post' => [
'path' => '/collection/add',
'action' => 'add',
'verb' => 'post',
],
'collection.edit.post' => [
'path' => '/collection/edit',
'action' => 'edit',
'verb' => 'post',
],
'collection.view' => [
'path' => '/collection/view{/view}',
'action' => 'index',
'params' => [],
'tokens' => [
'view' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'collection.delete' => [
'path' => '/collection/delete',
'action' => 'delete',
'verb' => 'post',
],
// ---------------------------------------------------------------------
// Manga Collection Routes
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Other Routes
// ---------------------------------------------------------------------
'character' => [
'path' => '/character/{slug}',
'action' => 'index',
'params' => [],
'tokens' => [
'slug' => '[a-z0-9\-]+'
]
],
'user_info' => [
'path' => '/me',
'action' => 'me',
'controller' => 'me',
'verb' => 'get',
],
// ---------------------------------------------------------------------
// Default / Shared routes
// ---------------------------------------------------------------------
'cache_purge' => [
'path' => '/cache_purge',
'action' => 'clearCache',
'controller' => DEFAULT_CONTROLLER_NAMESPACE,
'verb' => 'get',
],
'login' => [
'path' => '/login',
'action' => 'login',
'controller' => DEFAULT_CONTROLLER_NAMESPACE,
'verb' => 'get',
],
'login.post' => [
'path' => '/login',
'action' => 'loginAction',
'controller' => DEFAULT_CONTROLLER_NAMESPACE,
'verb' => 'post',
],
'logout' => [
'path' => '/logout',
'action' => 'logout',
'controller' => DEFAULT_CONTROLLER_NAMESPACE,
],
'update' => [
'path' => '/{controller}/update',
'action' => 'update',
'verb' => 'post',
'tokens' => [
'controller' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'update.post' => [
'path' => '/{controller}/update_form',
'action' => 'formUpdate',
'verb' => 'post',
'tokens' => [
'controller' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'edit' => [
'path' => '/{controller}/edit/{id}/{status}',
'action' => 'edit',
'tokens' => [
'id' => '[0-9a-z_]+',
'status' => '([a-zA-Z\-_]|%20)+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'list' => [
'path' => '/{controller}/{type}{/view}',
'action' => DEFAULT_CONTROLLER_METHOD,
'tokens' => [
'type' => '[a-z_]+',
'view' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
],
2017-03-30 16:16:40 -04:00
'index_redirect' => [
'path' => '/',
'controller' => DEFAULT_CONTROLLER_NAMESPACE,
'action' => 'redirectToDefaultRoute',
],
2016-01-06 11:08:56 -05:00
];