Mojolicious Full and Lite apps - understanding the difference
The mojocasts have thus far used lite apps exclusively to demonstrate basic Mojolicious functionality. This has led some to believe that Mojolicious is a one-file micro-framework; however, that is not the case.
Mojolicious a full-featured framework, supporting what some would call Catalyst-level deployments, in addition to one-file simple applications.
Mojolicious::Lite is a thin layer on top of the full framework - literally a 68-line module that provides Sinatra-like syntax, including the ability to embed base64-encoded binary files.
Full apps are a good choice for teams, and for sanely separating concerns for large web apps.
I've uploaded a sample application to demonstrate the differences, and allow folks to see first hand how to translate from Full to Lite, and vice-versa.
The example application demonstrates DBIx::Class integration, how to test your web app with Test::Mojo, as well as how to use EP templates with and without tag helpers. For those unfamiliar with testing in general, there are even examples of DBIC schema tests.
Both apps are identical in functionality:
Full app
Lite app
They are runnable using the morbo development server, as well as hypnotoad, the "full featured UNIX optimized preforking non-blocking I/O HTTP 1.1 and WebSocket server built around the very well tested and reliable Mojo::Server::Daemon with IPv6, TLS, Bonjour, libev and hot deployment support that just works".
Shnikies that's a lot of buzzwords for a Perl framework!
And as always, Mojolicious downloads and installs in about a minute:
curl -L cpanmin.us | perl - Mojolicious
Even better, enable parallel tests and you can install in about 15 seconds!
HARNESS_OPTIONS=j9 cpanm Mojolicious
\o/
Fantastic. Thank you for sharing. When the framework 'has 2 in 1', it will be better to have an example to demonstrate development with both, especially with identical web application.
Talking about Mojolicious and Mojolicious::Lite, is this an idea from PHP Laravel and Lumen. So far, Mojo rocks!