Consolidate routes forever

This commit is contained in:
swag 2022-10-12 23:21:13 -04:00
parent f549107dee
commit 99cef47f95
2 changed files with 7 additions and 10 deletions

View File

@ -32,7 +32,6 @@ Run the tests locally (against development environment):
## TODOs ## TODOs
1. Consolidate routes
1. Implement flag post button 1. Implement flag post button
1. Implement 1. Implement
[bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure) [bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure)

View File

@ -60,26 +60,24 @@ sub startup($self) {
$r->get('/', sub ($c) { $c->redirect_to('threads_list') }); $r->get('/', sub ($c) { $c->redirect_to('threads_list') });
# Thread # Thread
my $threads_list = $r->under('/list'); my $thread = $r->under('/thread');
$threads_list
$thread->under('/list')
->get('/:list_page', [list_page => qr/[0-9]+/], {list_page => 1}) ->get('/:list_page', [list_page => qr/[0-9]+/], {list_page => 1})
->to('thread#by_page') ->to('thread#by_page')
->name('threads_list'); ->name('threads_list');
my $post_thread = $r->under; $thread->any([qw{GET POST}], '/post')
$post_thread->any([qw{GET POST}], '/post')
->to('thread#create') ->to('thread#create')
->name('post_thread'); ->name('post_thread');
my $single_thread = $thread->under('/:thread_id', [thread_id => qr/[0-9]+/])
$r->under('/thread/:thread_id', [thread_id => qr/[0-9]+/]);
$single_thread
->get('/:thread_page', [thread_page => qr/[0-9]+/], {thread_page => 1}) ->get('/:thread_page', [thread_page => qr/[0-9]+/], {thread_page => 1})
->to('thread#by_id') ->to('thread#by_id')
->name('single_thread'); ->name('single_thread');
my $bump_thread = $r->under('/bump'); $thread->under('/bump')
$bump_thread->get('/:thread_id', [thread_id => qr/[0-9]+/]) ->get('/:thread_id', [thread_id => qr/[0-9]+/])
->to('thread#bump') ->to('thread#bump')
->name('bump_thread'); ->name('bump_thread');