examples/static-file/app.pl

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« examples/request-body/app.pl ↑ Summary examples/strong-params-deep/app.pl »
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;
« examples/request-body/app.pl ↑ Summary examples/strong-params-deep/app.pl »