|  |  
 |   |   
 NAMEHTTP::Engine::Middleware::Static - handler for static files SYNOPSIS    my $mw = HTTP::Engine::Middleware->new;
    $mw->install( 'HTTP::Engine::Middleware::Static' => {
        regexp  => qr{^/(robots.txt|favicon.ico|(?:css|js|img)/.+)$},
        docroot => '/path/to/htdocs/',
    });
    HTTP::Engine->new(
        interface => {
            module => 'YourFavoriteInterfaceHere',
            request_handler => $mw->handler( \&handler ),
        }
    )->run();
    # $ GET http//localhost/css/foo.css
    # to get the /path/to/htdocs/css/foo.css
    # $ GET http//localhost/js/jquery.js
    # to get the /path/to/htdocs/js/jquery.js
    # $ GET http//localhost/robots.txt
    # to get the /path/to/htdocs/robots.txt
has multi document root     my $mw = HTTP::Engine::Middleware->new;
    $mw->install(
        'HTTP::Engine::Middleware::Static' => {
            regexp  => qr{^/(robots.txt|favicon.ico|(?:css|js|img)/.+)$},
            docroot => '/path/to/htdocs/',
        },
        'HTTP::Engine::Middleware::Static' => {
            regexp  => qr{^/foo(/.+)$},
            docroot => '/foo/bar/',
        },
    );
    HTTP::Engine->new(
        interface => {
            module => 'YourFavoriteInterfaceHere',
            request_handler => $mw->handler( \&handler ),
        }
    )->run();
    # $ GET http//localhost/css/foo.css
    # to get the /path/to/htdocs/css/foo.css
    # $ GET http//localhost/robots.txt
    # to get the /path/to/htdocs/robots.txt
    # $ GET http//localhost/foo/baz.html
    # to get the /foo/bar/baz.txt
through only the specific URL to backend     my $mw = HTTP::Engine::Middleware->new;
    $mw->install( 'HTTP::Engine::Middleware::Static' => {
        regexp  => qr{^/(robots.txt|favicon.ico|(?:css|img)/.+|js/(?!dynamic).+)$},
        docroot => '/path/to/htdocs/',
    });
    HTTP::Engine->new(
        interface => {
            module => 'YourFavoriteInterfaceHere',
            request_handler => $mw->handler( \&handler ),
        }
    )->run();
    # $ GET http//localhost/js/jquery.js
    # to get the /path/to/htdocs/js/jquery.js
    # $ GET http//localhost/js/dynamic-json.js
    # to get the your application response
Will you want to set config from yaml?     my $mw = HTTP::Engine::Middleware->new;
    $mw->install( 'HTTP::Engine::Middleware::Static' => {
        regexp  => '^/(robots.txt|favicon.ico|(?:css|img)/.+|js/(?!dynamic).+)$',
        docroot => '/path/to/htdocs/',
    });
    HTTP::Engine->new(
        interface => {
            module => 'YourFavoriteInterfaceHere',
            request_handler => $mw->handler( \&handler ),
        }
    )->run();
    # $ GET http//localhost/js/jquery.js
    # to get the /path/to/htdocs/js/jquery.js
    # $ GET http//localhost/js/dynamic-json.js
    # to get the your application response
Do you want 404 handle has backend application?     my $mw = HTTP::Engine::Middleware->new;
    $mw->install( 'HTTP::Engine::Middleware::Static' => {
        regexp         => qr{^/css/.+)$},
        docroot        => '/path/to/htdocs/',
        is_404_handler => 0, # 404 handling off
    });
    HTTP::Engine->new(
        interface => {
            module => 'YourFavoriteInterfaceHere',
            request_handler => $mw->handler(sub {
                HTTP::Engine::Response->new( body => 'dynamic daikuma' );
            }),
        }
    )->run();
    # if css has foo.css file only
    # $ GET http//localhost/css/foo.css
    # to get the /path/to/htdocs/css/foo.css
    # $ GET http//localhost/css/bar.css
    # to get the 'dynamic daikuma' strings
DESCRIPTIONOn development site, you would feed some static contents from Interface::ServerSimple, or other stuff. This module helps that. AUTHORSKazuhiro Osawa typester (is_404_handler support) 
 
 |