update changelog in prep for release
[catagits/CatalystX-Declare.git] / examples / MyApp-Web / lib / MyApp / Web / Controller / Root.pm
CommitLineData
aa7921c5 1use CatalystX::Declare;
2
f00bea98 3namespace MyApp::Web;
4
aa7921c5 5# we consume a role that does what the RenderView action class
6# would normally do
f00bea98 7controller ::Controller::Root
8 with ::ControllerRole::RenderView {
aa7921c5 9
10 # $CLASS is provided by CLASS.pm
5a494dae 11 $CLASS->config(namespace => '');
aa7921c5 12
13
14 # this is the common root action for all other actions
15 action base under '/' as '';
16
17 # we group all our root actions under the common base
18 under base {
19
20 # this action catches /
21 final action root as '' {
22
23 $ctx->response->body( $ctx->welcome_message );
24 }
25
26 # this action takes all other /* parts. the (@) signature
27 # says we don't care about the arguments
28 final action not_found (@) as '' {
29
30 $ctx->response->body( 'Page Not Found' );
31 $ctx->response->status( 404 );
32 }
33 }
34}