• Stars
    star
    2,637
  • Rank 16,742 (Top 0.4 %)
  • Language
    Perl
  • License
    Artistic License 2.0
  • Created over 15 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

โœจ Mojolicious - Perl real-time web framework

Mojolicious is a fresh take on Perl web development, based on years of experience developing the Catalyst framework, and utilizing the latest web standards and technologies. You can get started with your project quickly, with a framework that grows with your needs.

The Mojo stack provides a consistent set of components that can be used in any project. The guides cover most aspects of using the framework and the components have comprehensive reference documentation. Mojolicious is a real-time web framework, which allows a new class of web applications using WebSockets and having long-running requests without blocking.

Join us now, and be a part of a friendly and knowledgeable community of developers!

Features

  • Most popular distribution on CPAN.
  • An amazing real-time web framework, allowing you to easily grow single file prototypes into well-structured MVC web applications.
    • Everything you need to build cloud-native web applications for state of the art container environments.
    • Powerful out of the box with RESTful routes, plugins, commands, Perl-ish templates, content negotiation, session management, form validation, testing framework, static file server, CGI/PSGI detection, first class Unicode support and much more for you to discover.
  • A powerful web development toolkit, that you can use for all kinds of applications, independently of the web framework.
    • Full stack HTTP and WebSocket client/server implementation with IPv6, TLS, SNI, IDNA, HTTP/SOCKS5 proxy, UNIX domain socket, Comet (long polling), Promises/A+, async/await, keep-alive, connection pooling, timeout, cookie, multipart, and gzip compression support.
    • Built-in non-blocking I/O web server, supporting multiple event loops as well as optional pre-forking and hot deployment, perfect for building highly scalable web services.
    • JSON and HTML/XML parser with CSS selector support.
  • Very clean, portable and object-oriented pure-Perl API with no hidden magic and no requirements besides Perl 5.26.0 (versions as old as 5.16.0 can be used too, but may require additional CPAN modules to be installed)
  • Also available for JavaScript.
  • Fresh code based upon years of experience developing Catalyst, free and open source.
  • Hundreds of 3rd party extensions and high quality spin-off projects like the Minion job queue.

Installation

All you need is a one-liner, it takes less than a minute.

$ curl -L https://cpanmin.us | perl - -M https://cpan.metacpan.org -n Mojolicious

We recommend the use of a Perlbrew environment.

Getting Started

These three lines are a whole web application.

use Mojolicious::Lite;

get '/' => {text => 'I โ™ฅ Mojolicious!'};

app->start;

To run the example with the built-in development web server, just put the code into a file and start it with morbo.

$ morbo hello.pl
Web application available at http://127.0.0.1:3000

Test it with any HTTP client you prefer.

$ curl http://127.0.0.1:3000/
I โ™ฅ Mojolicious!

Duct tape for the HTML5 web

Use all the latest Perl and HTML features in beautiful single file prototypes like this one, and grow them easily into well-structured Model-View-Controller web applications.

use Mojolicious::Lite -signatures;

# Render template "index.html.ep" from the DATA section
get '/' => sub ($c) {
  $c->render(template => 'index');
};

# WebSocket service used by the template to extract the title from a website
websocket '/title' => sub ($c) {
  $c->on(message => sub ($c, $msg) {
    my $title = $c->ua->get($msg)->result->dom->at('title')->text;
    $c->send($title);
  });
};

app->start;
__DATA__

@@ index.html.ep
% my $url = url_for 'title';
<script>
  const ws = new WebSocket('<%= $url->to_abs %>');
  ws.onmessage = function (event) { document.body.innerHTML += event.data };
  ws.onopen    = function (event) { ws.send('https://mojolicious.org') };
</script>

Want to know more?

Take a look at our excellent documentation!

More Repositories

1

mojo.js

๐Ÿฆ„ The Mojolicious real-time web framework for Node.js
JavaScript
467
star
2

minion

๐Ÿ™ Perl high performance job queue
Perl
222
star
3

mojo-pg

Mojolicious โค๏ธ PostgreSQL
Perl
101
star
4

mojolicious.org

๐Ÿช Mojolicious Website
CSS
32
star
5

mojo-assetpack

๐Ÿšœ Compress and convert CSS, Less, Sass and JavaScript files
Perl
29
star
6

mojo-status

๐Ÿณ Mojolicious server status
Perl
28
star
7

Mojo-AsyncAwait

๐Ÿ™€ An Async/Await implementation for Mojolicious
Perl
21
star
8

dom.js

๐Ÿ”ฎ A fast and very small HTML/XML DOM parser with CSS selectors
JavaScript
18
star
9

pg.js

mojo.js โค๏ธ PostgreSQL
JavaScript
16
star
10

minion.js

๐ŸŽ Node.js high performance job queue
JavaScript
14
star
11

vscode-mojo

๐Ÿ”ง VS Code support for Mojolicious
14
star
12

path.js

๐Ÿ•๏ธ Convenient container class for file system paths.
TypeScript
11
star
13

template.js

โšก A very fast embedded JavaScript template engine
JavaScript
11
star
14

server-starter

๐Ÿ’ซ Superdaemon
JavaScript
8
star
15

sql-abstract-pg

๐Ÿ˜ PostgreSQL features for SQL::Abstract
Perl
5
star
16

mojo-plugin-ejs

๐Ÿšง mojo.js plugin example
JavaScript
5
star
17

mojo-plugin-nunjucks

๐Ÿšง mojo.js plugin example (TypeScript)
TypeScript
3
star
18

mojojs.org

๐Ÿ’ฅ mojo.js website
CSS
3
star
19

create-full-app

๐Ÿฐ Create a full mojo.js app
JavaScript
3
star
20

sql.js

๐Ÿ—๏ธ Safely generate SQL statements with tagged template literals
JavaScript
3
star
21

vscode-mojo.js

๐ŸŽญ VS Code support for mojo.js
2
star
22

create-lite-app

๐Ÿญ Create a single file mojo.js app
JavaScript
2
star
23

mojo-plugin-middleware

๐Ÿช‚ Express.js middleware support for mojo.js
1
star
24

util.js

๐Ÿ”จ Just some utilities
JavaScript
1
star
25

user-agent.js

Experimental next gen user-agent
JavaScript
1
star