1Mojo::Server::PSGI(3) User Contributed Perl DocumentationMojo::Server::PSGI(3)
2
3
4

NAME

6       Mojo::Server::PSGI - PSGI server
7

SYNOPSIS

9         use Mojo::Server::PSGI;
10
11         my $psgi = Mojo::Server::PSGI->new;
12         $psgi->unsubscribe('request')->on(request => sub ($psgi, $tx) {
13
14           # Request
15           my $method = $tx->req->method;
16           my $path   = $tx->req->url->path;
17
18           # Response
19           $tx->res->code(200);
20           $tx->res->headers->content_type('text/plain');
21           $tx->res->body("$method request for $path!");
22
23           # Resume transaction
24           $tx->resume;
25         });
26         my $app = $psgi->to_psgi_app;
27

DESCRIPTION

29       Mojo::Server::PSGI allows Mojolicious applications to run on all PSGI
30       compatible servers.
31
32       See "DEPLOYMENT" in Mojolicious::Guides::Cookbook for more.
33

EVENTS

35       Mojo::Server::PSGI inherits all events from Mojo::Server.
36

ATTRIBUTES

38       Mojo::Server::PSGI inherits all attributes from Mojo::Server.
39

METHODS

41       Mojo::Server::PSGI inherits all methods from Mojo::Server and
42       implements the following new ones.
43
44   run
45         my $res = $psgi->run($env);
46
47       Run PSGI.
48
49   to_psgi_app
50         my $app = $psgi->to_psgi_app;
51
52       Turn Mojolicious application into PSGI application.
53

SEE ALSO

55       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
56
57
58
59perl v5.34.0                      2022-01-21             Mojo::Server::PSGI(3)
Impressum