/[Frey]/branches/mojo/lib/Frey/Mojo.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /branches/mojo/lib/Frey/Mojo.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 231 - (show annotations)
Sat Nov 1 13:20:25 2008 UTC (14 years, 1 month ago) by dpavlin
File size: 723 byte(s)
Mojolicous skeleton

mojolicious generate app Frey::Mojo
1 package Frey::Mojo;
2
3 use strict;
4 use warnings;
5
6 use base 'Mojolicious';
7
8 # This method will run for each request
9 sub dispatch {
10 my ($self, $c) = @_;
11
12 # Try to find a static file
13 $self->static->dispatch($c);
14
15 # Use routes if we don't have a response code yet
16 $self->routes->dispatch($c) unless $c->res->code;
17
18 # Nothing found
19 unless ($c->res->code) {
20 $self->static->serve($c, '/404.html');
21 $c->res->code(404);
22 }
23 }
24
25 # This method will run once at server start
26 sub startup {
27 my $self = shift;
28
29 # The routes
30 my $r = $self->routes;
31
32 # Default route
33 $r->route('/:controller/:action/:id')
34 ->to(controller => 'example', action => 'welcome', id => 1);
35 }
36
37 1;

  ViewVC Help
Powered by ViewVC 1.1.26