Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use Mojolicious::Lite;
- use utf8;
- get '/' => sub {
- my $c = shift;
- $c->render('index');
- };
- app->start;
- __DATA__
- @@ index.html.ep
- % layout 'default';
- % title 'Welcome';
- Welcome to the Mojolicious real-time web framework!
- @@ layouts/default.html.ep
- % use Mojo::JSON qw/j/;
- <!DOCTYPE html>
- <html>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <head><title><%= title %></title></head>
- <body><%= content %></body>
- абц <%== j({x => 'абц'}) %>;
- </html>
- --------------------------------------------
- curl -v http://localhost:3000/
- * Hostname was NOT found in DNS cache
- * Trying 127.0.0.1...
- * Connected to localhost (127.0.0.1) port 3000 (#0)
- > GET / HTTP/1.1
- > User-Agent: curl/7.36.0
- > Host: localhost:3000
- > Accept: */*
- >
- < HTTP/1.1 200 OK
- * Server Mojolicious (Perl) is not blacklisted
- < Server: Mojolicious (Perl)
- < Date: Fri, 26 Sep 2014 15:44:22 GMT
- < Content-Type: text/html;charset=UTF-8
- < Connection: keep-alive
- < Content-Length: 240
- <
- <!DOCTYPE html>
- <html>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <head><title>Welcome</title></head>
- <body>Welcome to the Mojolicious real-time web framework!
- </body>
- абц {"x":"абÑ"};
- </html>
- * Connection #0 to host localhost left intact
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement