NAME

WWW::Suffit::Server - The Suffit API web-server class

SYNOPSIS

WWW::Suffit::Server;

DESCRIPTION

This module provides API web-server functionality

OPTIONS

sub startup {
    my $self = shift->SUPER::startup( OPTION_NAME => VALUE, ... );

    # ...
}

List of allowed options:

all_features

all_features => 'on'

This option enables all of the init_* options, which are described bellow

Default: off

init_authdb

init_authdb => 'on'

This option enables AuthDB initialize

Default: off

init_api_routes

init_api_routes => 'on'

Enable Suffit API routes

Default: off

init_rsa_keys

init_rsa_keys => 'on'

This option enables RSA keys initialize

Default: off

ATTRIBUTES

This class implements the following attributes

cache

The Mojo::Cache object

configobj

The Config::General object or undef

datadir

The sharedstate data directory (data dir)

Default: /var/lib/<MONIKER>

debugmode

If this attribute is enabled then this server is no daemonize performs

documentroot

Document root directory

Default: /var/www/<MONIKER>

homedir

The Project home directory

Default: /usr/share/<MONIKER>

logfile

The log file

Default: /var/log/<MONIKER>.log

loglevel

This attribute performs set the log level

Default: warn

moniker

Project name in lowercase notation, project nickname, moniker. This value often used as default filename for configuration files and the like

Default: decamelizing the application class

See "moniker" in Mojolicious

mysecret

Default secret string

Default: <DEFAULT_SECRET>

project_name

The project name. For example: MyTestApp

Default: current class name

private_key

Private RSA key

project_version

The project version. For example: 1.00

NOTE! This is required attribute!

public_key

Public RSA key

tempdir

The temp directory

Default: /tmp/<MONIKER>

trustedproxies

List of trusted proxies

Default: none

server_url

Main listener URL.

See ListenAddr and ListenPort configuration directives

Default: http://127.0.0.1:8080

METHODS

This class inherits all methods from Mojolicious and implements the following new ones

listeners

This method returns server listeners as list of URLs

$prefork->listen($app->listeners);

raise

$self->raise("Mask %s", "val");
$self->raise("val");

Prints error message to STDERR and exit with errorlevel = 1

NOTE! For internal use only

reload

The reload hook

startup

Mojolicious application startup method

HELPERS

This class implements the following helpers

authdb

This is access method to the AuthDB object (state object)

jwt

This helper makes JWT object with RSA keys and returns it

token

This helper performs get of current token from HTTP Request headers

HISTORY

See Changes file

TO DO

See TODO file

SEE ALSO

Mojolicious, WWW::Suffit, WWW::Suffit::RSA, WWW::Suffit::JWT, WWW::Suffit::AuthDB

AUTHOR

Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2023 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/