| 1 | 1 | ▶ | use v5.40; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use experimental 'signatures'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use FindBin; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use PAGI::Nano; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | # Ports PAGI-Tools' app-01-file to PAGI::Nano. | ||
| 7 | # Static file serving (index resolution, MIME types, ETag/304, range requests, | ||
| 8 | # path-traversal protection) all come from PAGI::App::File, which `static` mounts | ||
| 9 | # under a prefix. Mounting at the bare root '/' is supported and serves the whole | ||
| 10 | # tree, just like the original pure file-server example. | ||
| 11 | # | ||
| 12 | # pagi-server app.pl | ||
| 13 | # curl http://127.0.0.1:5000/ | ||
| 14 | |||
| 15 | 1 | my $dir = "$FindBin::Bin/public/"; | |
| 16 | |||
| 17 | 1 | ▶ | my $app = app { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 18 | 1 | static '/' => $dir; | |
| 19 | 1 | }; | |
| 20 | |||
| 21 | 1 | $app; | |