|
NAMEDancer::Plugin::CORS - A plugin for using cross origin resource sharing VERSIONversion 0.13 DESCRIPTIONCross origin resource sharing is a feature used by modern web browser to bypass cross site scripting restrictions. A webservice can provide those rules from which origin a client is allowed to make cross-site requests. This module helps you to setup such rules. SYNOPSIS use Dancer::Plugin::CORS;
get '/foo' => sub { ... };
share '/foo' =>
origin => 'http://localhost/',
credentials => 1,
expose => [qw[ Content-Type ]],
method => 'GET',
headers => [qw[ X-Requested-With ]],
maxage => 7200,
timing => 1,
;
METHODSshare($route, %options)The parameter $route may be any valid path like used get, post, put, delete or patch but not option. Alternatively a Dancer::Route object may be used instead: $route = post '/' => sub { ... };
share $route => ... ;
Or a arrayref to one or more Routes: @head_and_get = get '/' => sub { ... };
share \@head_and_get => ...;
This syntax works too: share [ get ('/' => sub { ... }) ] => ...;
For any route more than one rule may be defined. The order is relevant: the first matching rule wins. Following keywords recognized by %options:
sharingThis keyword is a helper for re-using rules for many routes. See Dancer::Plugin::CORS::Sharing for more information about this feature. BUGSPlease report any bugs or feature requests on the bugtracker website https://github.com/zurborg/libdancer-plugin-cors-perl/issues When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHORDavid Zurborg <zurborg@cpan.org> COPYRIGHT AND LICENSEThis software is Copyright (c) 2014 by David Zurborg. This is free software, licensed under: The ISC License
|