pgxn_api_server - The PGXN API server
pgxn_api_server --doc-root /var/www/api \ --errors-from firstname.lastname@example.org \ --errors-to email@example.com
This is the PGXN API PSGI server. It automatically figures out the environment it is run in, and runs your application in that environment.
AnyEvent and others can all be detected. See Plack::Loader for the authoritative list.
--errors-to EMAIL Email to which error messages should be sent. --errors-from EMAIL Email to use on the From line of error messages. --doc-root PATH Location of the API document root. -o --host Bind TCP daemon to the specified interface. -p --port Listen on the specified TCP port. -s --server Plack server to use. -S --socket UNIX domain socket path to listen on. -l --listen Address to listen on. -D --daemonize Make the process go to the background. -I PATH Specify a Perl include library path. -E --env ENV Run with the specified environment. -r --reload Reload when a development file changes. -R --Reload PATH Reload when a file in the specified path changes. -L --loader LOADER Run with specified loading class. --access-log PATH Write access log to the specified file. -h --help Print a usage statement and exit. -m --man Print the complete documentation and exit. -v --version Print the version number and exit.
Specify an email address to which to send error information. Whenever the server encounters a 500 error, it will send detailed information, including a stack trace, to this address.
The email address from which error messages should appear to be sent.
The path to use for the API document root. Should be the same path as that managed by pgxn_api_sync.
The interface a TCP based server daemon binds to. Defaults to
undef, which lets most server back ends bind the any (
*) interface. This option does nothing if the server does not support TCP socket.
The port number a TCP based server daemon listens on. Defaults to 5000. This option does nothing if the server does not support TCP socket.
Select a specific implementation to run on using the
PLACK_SERVERenvironment variable or use the
--serverflag which will be preferred over the environment variable.
UNIX domain socket path to listen on. Defaults to
undef. This option does nothing if the server doesn't support UNIX sockets.
Addresses on which to listen. It could be
PATH(without colons). It could be multiple but it depends on the server implementations whether multiple interfaces are supported.
Makes the process go background. It's up to the back end server/handler implementation whether this option is respected or not.
Specify perl library include path, like
perl's -I option.
Specify the environment option (default is
development). You can set this value by setting
PLACK_ENVenvironment variable as well, and specifying the value with the command line options writes back to
PLACK_ENVas well, so the API server can tell which environment setting the application is running on.
# These two are the same pgxn_api_server -E deployment env PLACK_ENV=deployment pgxn_api_server
The value can be anything but commonly used ones are
If it's set to
development, following middleware components are enabled by default:
Watch for updates in your development directory and restart the server whenever a file is updated. This option by default watches the
-Rif you want to watch other directories.
-Roption allows you to specify the path to watch file updates separated by comma (
pgxn_api_server -R /path/to/project/lib,/path/to/project/templates
Specify the server loading subclass that implements how to run the server. Available options are Plack::Loader (default),
Restarter(automatically set when
-Ris used), Delayed and Shotgun.
Specify the path to a file where the access log should be written. By default, in the development environment access logs will go to
Outputs usage information and exits.
Outputs this full documentation and exits.
Outputs the version and exits.
Other options that starts with
-- are passed through to the back end server. See the appropriate Plack::Handler back end documentation to see which options are available.
David E. Wheeler <firstname.lastname@example.org>
Copyright (c) 2011-2013 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under the PostgreSQL License.
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
In no event shall David E. Wheeler be liable to any party for direct, indirect, special, incidental, or consequential damages, including lost profits, arising out of the use of this software and its documentation, even if David E. Wheeler has been advised of the possibility of such damage.
David E. Wheeler specifically disclaims any warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The software provided hereunder is on an "as is" basis, and David E. Wheeler has no obligations to provide maintenance, support, updates, enhancements, or modifications.