NAME

Mojolicious::Plugin::WebAPI - Mojolicious::Plugin::WebAPI - mount WebAPI::DBIC in your Mojolicious app

VERSION

version 0.04

SYNOPSIS

# load DBIx::Class schema
use MyApp::Schema;
my $schema = MyApp::Schema->connect('DBI:SQLite:test.db');

# create base route for api
my $route = $self->routes->route('/api/v0');
$self->plugin('WebAPI' => {
    schema => $schema,
    route  => $route,
});



# now with a route that can check for authentication
use MyApp::Schema;
my $schema = MyApp::Schema->connect('DBI:SQLite:test.db');

# create base route for api
my $auth  = $self->routes->auth('/')->to('auth#test');
my $route = $auth->route('/api/v0');
$self->plugin('WebAPI' => {
    schema => $schema,
    route  => $route,
});


# disable http basic auth
$self->plugin('WebAPI' => {
  schema => $schema,
  route  => $route,

  resource_opts => {
    resource_default_args => {
      http_auth_type => 'none',
    },
  },
});

DESCRIPTION

This is just the glue to mount the webapi into your application. The hard work is done by WebAPI::DBIC. The code for Proxy.pm is mostly from Mojolicious::Plugin::MountPSGI.

CONFIGURATION

You can pass the following options when loading the plugin:

schema

route

resource_opts

Here you can set all options that can be used to change the behaviour of WebAPI::DBIC::RouteMaker.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018 by Renee Baecker.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)