PHP Classes

File: demos/static.php

Recommend this page to a friend!
  Classes of Francesco Danti   ATK4 FastRoute   demos/static.php   Download  
File: demos/static.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ATK4 FastRoute
Process HTTP requests using configured routes
Author: By
Last change:
Date: 5 years ago
Size: 460 bytes
 

Contents

Class file image Download
<?php

include __DIR__.'/bootstrap.php';

use
Abbadon1334\ATKFastRoute\Handler\RoutedServeStatic;
use
Abbadon1334\ATKFastRoute\Router;
use
atk4\ui\App;

$router = new Router(new App(['always_run' => false]));
//$router->setBaseDir('/'); // added only for coverage in unit test
$router->addRoute(
   
'/assets/{path:.+}',
    [
'GET'],
    new
RoutedServeStatic(
       
__DIR__.'/static_assets',
        [
           
'css',
        ]
    )
);

$router->run();