diff --git a/lib/LDV.pm b/lib/LDV.pm index 240993c..0b1c313 100644 --- a/lib/LDV.pm +++ b/lib/LDV.pm @@ -19,11 +19,16 @@ sub startup { my $r = $self->routes; # /user - $r->get('/user/login')->to('user#login'); - $r->get('/user/create')->to('user#create'); - $r->get('/user/update')->to('user#update'); + my $user = $r->route('/user') -> to(controller => 'user'); + $user->get('/') ->to(cb => sub { shift->redirect_to('/user/login'); }); + $user->get('/login') ->to(action => 'login'); + $user->get('/register') ->to(action => 'register'); + $user->get('/profile') ->to(action => 'profile'); - $r->post('/user/create')->to('actions#create'); + $user->post('/auth') ->to(action => 'auth'); + $user->get ('/logout') ->to(action => 'logout'); + $user->post('/create') ->to(action => 'create'); + $user->post('/update') ->to(action => 'update'); # /zerobin my $zb = $r->route('/zerobin2') -> to(controller => 'zerobin'); @@ -31,8 +36,8 @@ sub startup { $zb->get ('/') -> to(action => 'create'); $zb->route('/:time', time => qr/\d+/) ->via('GET') -> to(action => 'view'); - my $root = $self->app->config->{zerobin}->{root}; - mkdir $self->app->home->rel_dir($root); + my $root = $self->app->config->{zerobin}->{root}; + mkdir $self->app->home->rel_dir($root); } 1;