From 0bf98c2bf1f90e5933f593829a52c0941c62f85c Mon Sep 17 00:00:00 2001 From: Avior Date: Fri, 29 Mar 2019 00:10:42 +0100 Subject: [PATCH] Reworked routing for future usage with caching --- src/Modules/Index/index.json | 26 +++++++++++++++++++------- src/Modules/ModuleName/modulename.json | 16 +++++++++++++--- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/Modules/Index/index.json b/src/Modules/Index/index.json index 656adcf..68109f6 100644 --- a/src/Modules/Index/index.json +++ b/src/Modules/Index/index.json @@ -1,19 +1,31 @@ { "routes": { - "route_name": { + "index": { "path": "/", "controller": "\\Index\\Controller\\IndexController", "function": "index" }, - "route_name2": { - "path": "/test/{slug}/", - "controller": "\\Index\\Controller\\IndexController", - "function": "test", + "css": { + "path": "/style.css", + "file": "/css/style.css", + "type": "text/css", + "headers": { + "Content-Type": "text/css" + } + }, + "arg": { + "path": "/{arg}/{arg2}", + "controller": "\\ModuleName\\Controller\\ExampleController", + "function": "example", "args": { - "slug": { + "arg": { "regex": "/[a-z]+/" + }, + "arg2": { + "option": "test.option" } } } - } + }, + "templateFolder": "/Templates/" } diff --git a/src/Modules/ModuleName/modulename.json b/src/Modules/ModuleName/modulename.json index 8c320c0..e66154b 100644 --- a/src/Modules/ModuleName/modulename.json +++ b/src/Modules/ModuleName/modulename.json @@ -1,8 +1,18 @@ { "routes": { - "route_name": { - "path": "/example/test-{arg}", - "controller": "\\AdminPanel\\Modules\\ModuleName\\Controller\\ExampleController", + "example_route": { + "path": "/example", + "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", "args": { "arg": {