Mojolicious::Plugin::WebAPI - Mojolicious::Plugin::WebAPI - mount WebAPI::DBIC in your Mojolicious app
version 0.03
# 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', }, }, });
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.
Proxy.pm
You can pass the following options when loading the plugin:
Here you can set all options that can be used to change the behaviour of WebAPI::DBIC::RouteMaker.
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
Renee Baecker <reneeb@cpan.org>
This software is Copyright (c) 2015 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Mojolicious::Plugin::WebAPI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::WebAPI
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::WebAPI
For more information on module installation, please visit the detailed CPAN module installation guide.