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 {
13           my ($psgi, $tx) = @_;
14
15           # Request
16           my $method = $tx->req->method;
17           my $path   = $tx->req->url->path;
18
19           # Response
20           $tx->res->code(200);
21           $tx->res->headers->content_type('text/plain');
22           $tx->res->body("$method request for $path!");
23
24           # Resume transaction
25           $tx->resume;
26         });
27         my $app = $psgi->to_psgi_app;
28

DESCRIPTION

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

EVENTS

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

ATTRIBUTES

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

METHODS

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

SEE ALSO

56       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
57
58
59
60perl v5.28.0                      2018-05-24             Mojo::Server::PSGI(3)
Impressum