diff --git a/README.md b/README.md index e47325b..4f96c6b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Run the tests locally (against development environment): ## TODOs -1. Consolidate routes 1. Implement flag post button 1. Implement [bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure) diff --git a/lib/PostText.pm b/lib/PostText.pm index 80b9452..3c6577c 100644 --- a/lib/PostText.pm +++ b/lib/PostText.pm @@ -60,26 +60,24 @@ sub startup($self) { $r->get('/', sub ($c) { $c->redirect_to('threads_list') }); # Thread - my $threads_list = $r->under('/list'); - $threads_list + my $thread = $r->under('/thread'); + + $thread->under('/list') ->get('/:list_page', [list_page => qr/[0-9]+/], {list_page => 1}) ->to('thread#by_page') ->name('threads_list'); - my $post_thread = $r->under; - $post_thread->any([qw{GET POST}], '/post') + $thread->any([qw{GET POST}], '/post') ->to('thread#create') ->name('post_thread'); - my $single_thread = - $r->under('/thread/:thread_id', [thread_id => qr/[0-9]+/]); - $single_thread + $thread->under('/:thread_id', [thread_id => qr/[0-9]+/]) ->get('/:thread_page', [thread_page => qr/[0-9]+/], {thread_page => 1}) ->to('thread#by_id') ->name('single_thread'); - my $bump_thread = $r->under('/bump'); - $bump_thread->get('/:thread_id', [thread_id => qr/[0-9]+/]) + $thread->under('/bump') + ->get('/:thread_id', [thread_id => qr/[0-9]+/]) ->to('thread#bump') ->name('bump_thread');