Mojo::Server::PSGI(3)

🌸 Mojo::Server::PSGI(3) 🌸

This is the User Contributed Perl Documentation page for Mojo::Server::PSGI, bestie β€” manual name right up top: Mojo::Server::PSGI(3). We're doing full group-chat energy, but every detail is staying. Periodt. πŸ’…


✨ NAME ✨

Mojo::Server::PSGI β€” PSGI server. Short, sweet, and absolutely serving. πŸ‘‘

πŸ¦‹ SYNOPSIS πŸ¦‹

use Mojo::Server::PSGI;

my $psgi = Mojo::Server::PSGI->new;
$psgi->unsubscribe('request')->on(request => sub ($psgi, $tx) {

  # Request
  my $method = $tx->req->method;
  my $path   = $tx->req->url->path;

  # Response
  $tx->res->code(200);
  $tx->res->headers->content_type('text/plain');
  $tx->res->body("$method request for $path!");

  # Resume transaction
  $tx->resume;
});
my $app = $psgi->to_psgi_app;

πŸ’– DESCRIPTION πŸ’–

So, <pink>Mojo::Server::PSGI</pink> lets <purple>Mojolicious</purple> applications run on all PSGI compatible servers. No cap β€” all of them. 🫢

For more, see "DEPLOYMENT" in Mojolicious::Guides::Cookbook. That's the guide, bestie. 🌈

πŸŽ€ EVENTS πŸŽ€

Mojo::Server::PSGI inherits all events from Mojo::Server. That's the whole section, and honestly? Inheriting slay. πŸ’€

πŸ”₯ ATTRIBUTES πŸ”₯

Mojo::Server::PSGI inherits all attributes from Mojo::Server. Same energy, same source. ✨

πŸ‘‘ METHODS πŸ‘‘

Mojo::Server::PSGI inherits all methods from Mojo::Server and implements the following new ones. Let's get into it. 🫢

🌟 run 🌟

my $res = $psgi->run($env);

Run PSGI. That's it. That's the method. Iconic and to the point. πŸ’…

πŸ¦‹ to_psgi_app πŸ¦‹

my $app = $psgi->to_psgi_app;

Turn Mojolicious application into PSGI application. Literally the glow-up. πŸŽ€

🌈 SEE ALSO 🌈

xoxo, your Unix bestie πŸ’‹ β€” this page is from perl v5.42.0, dated 2026-07-15. Mwah! πŸŽ€

πŸ“¦ where this page comes from