Reworked routing for future usage with caching

This commit is contained in:
Florian Bouillon 2019-03-29 00:10:42 +01:00
parent 5d522a2064
commit 0bf98c2bf1
2 changed files with 32 additions and 10 deletions

View File

@ -1,19 +1,31 @@
{ {
"routes": { "routes": {
"route_name": { "index": {
"path": "/", "path": "/",
"controller": "\\Index\\Controller\\IndexController", "controller": "\\Index\\Controller\\IndexController",
"function": "index" "function": "index"
}, },
"route_name2": { "css": {
"path": "/test/{slug}/", "path": "/style.css",
"controller": "\\Index\\Controller\\IndexController", "file": "/css/style.css",
"function": "test", "type": "text/css",
"headers": {
"Content-Type": "text/css"
}
},
"arg": {
"path": "/{arg}/{arg2}",
"controller": "\\ModuleName\\Controller\\ExampleController",
"function": "example",
"args": { "args": {
"slug": { "arg": {
"regex": "/[a-z]+/" "regex": "/[a-z]+/"
},
"arg2": {
"option": "test.option"
} }
} }
} }
} },
"templateFolder": "/Templates/"
} }

View File

@ -1,8 +1,18 @@
{ {
"routes": { "routes": {
"route_name": { "example_route": {
"path": "/example/test-{arg}", "path": "/example",
"controller": "\\AdminPanel\\Modules\\ModuleName\\Controller\\ExampleController", "controller": "\\ModuleName\\Controller\\ExampleController",
"function": "index"
},
"loggedIn": {
"path":"/example/is-logged",
"controller":"\\ModuleName\\Controller\\ExampleController",
"function": "isLoggedIn"
},
"example_route_with_arg": {
"path": "/example/{arg}",
"controller": "\\ModuleName\\Controller\\ExampleController",
"function": "example", "function": "example",
"args": { "args": {
"arg": { "arg": {