Clean up routing
This commit is contained in:
parent
9a65aff125
commit
088daa120d
|
@ -90,8 +90,7 @@ sub startup($self) {
|
||||||
# Thread
|
# Thread
|
||||||
my $thread = $r->under('/thread');
|
my $thread = $r->under('/thread');
|
||||||
|
|
||||||
$thread->under('/list')
|
$thread->get('/list/:list_page', [list_page => qr/\d+/], {list_page => 1})
|
||||||
->get('/:list_page', [list_page => qr/\d+/], {list_page => 1})
|
|
||||||
->to('thread#by_page')
|
->to('thread#by_page')
|
||||||
->name('threads_list');
|
->name('threads_list');
|
||||||
|
|
||||||
|
@ -104,31 +103,26 @@ sub startup($self) {
|
||||||
->to('thread#by_id')
|
->to('thread#by_id')
|
||||||
->name('single_thread');
|
->name('single_thread');
|
||||||
|
|
||||||
$thread->under('/bump')
|
$thread->get('/bump/:thread_id', [thread_id => qr/\d+/])
|
||||||
->get('/:thread_id', [thread_id => qr/\d+/])
|
|
||||||
->to('thread#bump')
|
->to('thread#bump')
|
||||||
->name('bump_thread');
|
->name('bump_thread');
|
||||||
|
|
||||||
$thread->under('/flag')
|
$thread->get('/flag/:thread_id', [thread_id => qr/\d+/])
|
||||||
->get('/:thread_id', [thread_id => qr/\d+/])
|
|
||||||
->to('thread#flag')
|
->to('thread#flag')
|
||||||
->name('flag_thread');
|
->name('flag_thread');
|
||||||
|
|
||||||
# Remark
|
# Remark
|
||||||
my $remark = $r->under('/remark');
|
my $remark = $r->under('/remark');
|
||||||
|
|
||||||
$remark->under('/post')
|
$remark->any([qw{GET POST}], '/post/:thread_id', [thread_id => qr/\d+/])
|
||||||
->any([qw{GET POST}], '/:thread_id', [thread_id => qr/\d+/])
|
|
||||||
->to('remark#create')
|
->to('remark#create')
|
||||||
->name('post_remark');
|
->name('post_remark');
|
||||||
|
|
||||||
$remark->under('/single')
|
$remark->get('/single/:remark_id', [remark_id => qr/\d+/])
|
||||||
->get('/:remark_id', [remark_id => qr/\d+/])
|
|
||||||
->to('remark#by_id')
|
->to('remark#by_id')
|
||||||
->name('single_remark');
|
->name('single_remark');
|
||||||
|
|
||||||
$remark->under('/flag')
|
$remark->get('/flag/:remark_id', [remark_id => qr/\d+/])
|
||||||
->get('/:remark_id', [remark_id => qr/\d+/])
|
|
||||||
->to('remark#flag')
|
->to('remark#flag')
|
||||||
->name('flag_remark');
|
->name('flag_remark');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user