20241102#1
This commit is contained in:
13
application/config/routes/99-main.yaml
Normal file
13
application/config/routes/99-main.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
# Index
|
||||
- key: "/"
|
||||
routes:
|
||||
- action: "App\\Infrastructure\\Controllers\\IndexController"
|
||||
method: "index"
|
||||
params: ""
|
||||
|
||||
# Empty
|
||||
- key: "<@any>"
|
||||
routes:
|
||||
- action: "App\\nfrastructure\\Controllers\\IndexController"
|
||||
method: "emptyAction"
|
||||
params: ""
|
||||
16
application/config/routes/routes.php
Normal file
16
application/config/routes/routes.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$cashFile = preg_replace("'.application.*$'",'', __DIR__).'/var/routes/'.md5(__FILE__);
|
||||
|
||||
if(getenv("APP_MODE") == "PROD" && file_exists($cashFile)){
|
||||
return unserialize(file_get_contents($cashFile));
|
||||
} else {
|
||||
$routesCollection = array_map(function ($routesFile){
|
||||
return file_get_contents($routesFile).PHP_EOL;
|
||||
}, glob(__DIR__."/{*.yaml}", GLOB_BRACE));
|
||||
|
||||
$routes = yaml_parse(implode($routesCollection));
|
||||
if (!is_dir(dirname($cashFile))) mkdir(dirname($cashFile), 0777, true);
|
||||
file_put_contents($cashFile, serialize($routes));
|
||||
return $routes;
|
||||
}
|
||||
Reference in New Issue
Block a user