remove any leading ::ffff: on ipv4 addresses
[spider.git] / perl / mojonode.pl
1 #!/usr/bin/env perl
2 use Mojolicious::Lite;
3
4 # Documentation browser under "/perldoc"
5 plugin 'PODRenderer';
6 plugin 'DefaultHelpers';
7
8 app->secrets(['A:new.&.S3cure!passw0rd?']);
9 app->sessions->cookie_name('DXSpider');
10
11 get '/' => sub {
12         my $self = shift;
13         $self->render('index');
14 };
15
16
17 # Not found (404)
18 get '/missing' => sub { shift->render('does_not_exist') };
19
20 # Exception (500)
21 get '/dies' => sub { die 'Intentional error' };
22
23 app->start;
24
25
26 __DATA__
27
28 @@ index.html.ep
29 % layout 'default';
30 % title 'Welcome';
31 Welcome to the Mojolicious real-time web framework!
32
33 @@ layouts/default.html.ep
34 <!DOCTYPE html>
35 <html lang="en">
36   <head>
37     <meta charset="utf-8">
38     <meta http-equiv="X-UA-Compatible" content="IE=edge">
39     <meta name="viewport" content="width=device-width, initial-scale=1">
40     <title><%= title %></title>
41
42     <!-- Bootstrap -->
43     <link href="css/bootstrap.min.css" rel="stylesheet">
44
45     <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
46     <!-- WARNING: Respond.js doesnt work if you view the page via file:// -->
47     <!--[if lt IE 9]>
48       <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
49       <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
50     <![endif]-->
51   </head>
52   <body>
53     <h1><%= title %></h1>
54
55     <%= content %>
56
57     <!-- jQuery (necessary for Bootstraps JavaScript plugins) -->
58     <script src="js/jquery-1.11.1.min.js"></script>
59     <!-- Include all compiled plugins (below), or include individual files as needed -->
60     <script src="js/bootstrap.min.js"></script>
61   </body>
62 </html>
63