diff --git a/.proverc b/.proverc new file mode 100644 index 0000000..c96eebc --- /dev/null +++ b/.proverc @@ -0,0 +1,2 @@ +-I lib +-j4 diff --git a/README.md b/README.md new file mode 100644 index 0000000..f600229 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# TorChat + diff --git a/lib/TorChat.pm b/lib/TorChat.pm new file mode 100644 index 0000000..27c562a --- /dev/null +++ b/lib/TorChat.pm @@ -0,0 +1,21 @@ +package TorChat; +use Mojo::Base 'Mojolicious'; + +# This method will run once at server start +sub startup { + my $self = shift; + + # Load configuration from hash returned by "my_app.conf" + my $config = $self->plugin('Config'); + + # Documentation browser under "/perldoc" + $self->plugin('PODRenderer') if $config->{perldoc}; + + # Router + my $r = $self->routes; + + # Normal route to controller + $r->get('/')->to('example#welcome'); +} + +1; diff --git a/lib/TorChat/Controller/Example.pm b/lib/TorChat/Controller/Example.pm new file mode 100644 index 0000000..18e561d --- /dev/null +++ b/lib/TorChat/Controller/Example.pm @@ -0,0 +1,12 @@ +package TorChat::Controller::Example; +use Mojo::Base 'Mojolicious::Controller'; + +# This action will render a template +sub welcome { + my $self = shift; + + # Render template "example/welcome.html.ep" with message + $self->render(msg => 'Welcome to the Mojolicious real-time web framework!'); +} + +1; diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..e74bb5f --- /dev/null +++ b/public/index.html @@ -0,0 +1,11 @@ + + +
++ This page was generated from the template "templates/example/welcome.html.ep" + and the layout "templates/layouts/default.html.ep", + <%= link_to 'click here' => url_for %> to reload the page or + <%= link_to 'here' => '/index.html' %> to move forward to a static page. + % if (config 'perldoc') { + To learn more, you can also browse through the documentation + <%= link_to 'here' => '/perldoc' %>. + % } +
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep new file mode 100644 index 0000000..599c556 --- /dev/null +++ b/templates/layouts/default.html.ep @@ -0,0 +1,5 @@ + + +