The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::Dochazka::REST::Resource - web resource definition

VERSION

Version 0.098

SYNOPSIS

In PSGI file:

    use Web::Machine;

    Web::Machine->new(
        resource => 'App::Dochazka::REST::Resource',
    )->to_app;

DESCRIPTION

This is where we provide our own versions of various methods used by our "web framework": Web::Machine.

Methods/attributes not defined in this module will be inherited from Web::Machine::Resource.

METHODS

content_types_provided

Web::Machine calls this routine to determine how to generate the response body. It says: "generate responses in JSON using the 'render' method".

render_html

Whip out some HTML to educate passersby.

render_json

Encode the context as a JSON string.

context

This method is where we store data that needs to be shared among various "users" of the given object (i.e. among routines in this module).

charsets_provided

This method causes Web::Machine to encode the response body in UTF-8.

default_charset

Really use UTF-8 all the time.

allowed_methods

Determines which HTTP methods we recognize.

uri_too_long

Is the URI too long?

is_authorized

Authenticate the originator of the request, using HTTP Basic Authentication.

forbidden

Parse the path to determine what is being asked of us. At the same time, check if the user (employee) is authorized to do that.