20241004#1

This commit is contained in:
User
2024-10-04 03:00:11 +03:00
parent 99f78f7362
commit 1b0af12a46
37 changed files with 57 additions and 59 deletions

View 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: ""

15
config/routes/routes.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
if(getenv("APP_MODE") == "PROD" && file_exists(dirname(__DIR__,2).'/var/routes/routes-main')){
return unserialize(file_get_contents(dirname(__DIR__,2).'/var/routes/routes-main'));
} 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(__DIR__, 2).'/var/routes')) mkdir(dirname(__DIR__, 2).'/var/routes', 0777, true);
file_put_contents(dirname(__DIR__, 2).'/var/routes/routes-main', serialize($routes));
return $routes;
}