1Mojo::UserAgent::ServerU(s3e)r Contributed Perl DocumentaMtoijoon::UserAgent::Server(3)
2
3
4

NAME

6       Mojo::UserAgent::Server - Application server
7

SYNOPSIS

9         use Mojo::UserAgent::Server;
10
11         my $server = Mojo::UserAgent::Server->new;
12         say $server->url;
13

DESCRIPTION

15       Mojo::UserAgent::Server is an embedded web server based on
16       Mojo::Server::Daemon that processes requests for Mojo::UserAgent.
17

ATTRIBUTES

19       Mojo::UserAgent::Server implements the following attributes.
20
21   ioloop
22         my $loop = $server->ioloop;
23         $server  = $server->ioloop(Mojo::IOLoop->new);
24
25       Event loop object to use for I/O operations, defaults to the global
26       Mojo::IOLoop singleton.
27

METHODS

29       Mojo::UserAgent::Server inherits all methods from Mojo::Base and
30       implements the following new ones.
31
32   app
33         my $app = Mojo::UserAgent::Server->app;
34                   Mojo::UserAgent::Server->app(Mojolicious->new);
35         my $app = $server->app;
36         $server = $server->app(Mojolicious->new);
37
38       Application this server handles, instance specific applications
39       override the global default.
40
41         # Change application behavior
42         $server->app->defaults(testing => 'oh yea!');
43
44   nb_url
45         my $url = $server->nb_url;
46         my $url = $server->nb_url('http');
47         my $url = $server->nb_url('https');
48
49       Get absolute Mojo::URL object for server processing non-blocking
50       requests with "app" and switch protocol if necessary.
51
52   restart
53         $server->restart;
54
55       Restart server with new port.
56
57   url
58         my $url = $server->url;
59         my $url = $server->url('http');
60         my $url = $server->url('https');
61
62       Get absolute Mojo::URL object for server processing blocking requests
63       with "app" and switch protocol if necessary.
64

SEE ALSO

66       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
67
68
69
70perl v5.32.1                      2021-02-07        Mojo::UserAgent::Server(3)
Impressum