[dancer-users] Dancer NGINX configutation

Richard Reina gatorreina at gmail.com
Tue Mar 8 16:16:17 GMT 2016


> I think we're talking at cross-purposes here.
>
> You don't need to be running plackup in order to use Plack middleware. You
> just need to be running a PSGI app - which you are, it's in your app.psgi.
>
> Assuming that you're using the app,psgi that dancer2 originally generated
> for you, then it will look something like this:
>
>     #!/usr/bin/env perl
>
>     use strict;
>     use warnings;
>     use FindBin;
>     use lib "$FindBin::Bin/../lib";
>
>     use MyWebApp;
>     MyWebApp->to_app;
>
> (Obviously substituting the name of your app for "MyWebApp".)
>
> To add Plack::Middleware::Static, you would change it to look something
> like this:
>
>     #!/usr/bin/env perl
>
>     use strict;
>     use warnings;
>     use FindBin;
>     use lib "$FindBin::Bin/../lib";
>
>     use Plack::Builder;
>
>     use MyWebApp;
>
>     builder {
>       enable 'Plack::Middleware::Static',
>         path => qr{^/(javascripts|css)/} , root => './public/';
>       MyWebApp->to_app;
>     };
>
> To (attempt to) be completely clear - you can use Plack middleware with
> any PSGI app. You don't need to be running it under plackup. Running it
> under Starman (or any other PSGI server) will work just as well.
>
> Hope that's clearer.
>
>
> Dave...
>
>
> Dave,

Thank you for the very clear and isntructive reply. Sorry about the
top-post earlier. I wil try your recipe.

I take it that I should inlcude the name of any directories such as
'images' (along with javascript & css ) in ./public that I want plack to
serve directly correct?

Again, thank you very much for your help.

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20160308/3e68f096/attachment.html>


More information about the dancer-users mailing list