-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
335 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 1.0.1-beta | ||
|
||
Mapeado os parâmetros da rota, com os parâmetros da _action_: | ||
|
||
/post/:date/:slug | ||
function postagens($slug, $date) { ... } | ||
|
||
:date -> $date | ||
:slug -> $slug | ||
|
||
Passado a execução da Rota para a classe \Core\Dispatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
use \Core\Routes\Router; | ||
|
||
// Seta a rota de erro 404 | ||
Router::notfound([ | ||
'controller' => 'Error', | ||
'action' => 'index' | ||
]); | ||
|
||
|
||
// Setá a rota padrão, home/index | ||
Router::main([ | ||
'controller' => 'Main', | ||
'action' => 'index' | ||
]); | ||
|
||
// Apenas replicando a rota padrão para ser acessada através do endereço /index | ||
Router::route('/index', Router::main()); | ||
|
||
// Rota para o formulário de LOGIN, acessível apenas via GET | ||
Router::get('/entrar', 'entrar', [ | ||
'controller' => 'Login', | ||
'action' => 'index' | ||
]); | ||
|
||
// Replicando a rota /entrar para /login. Permitira acesso pelo mesmo Method que a rota /entrar (GET) | ||
Router::route('/login', 'login.form', Router::GetByName('entrar')->_clone()); | ||
|
||
// Rota para realizar o login, acessível apenas via POST | ||
Router::post('/login', 'login', [ | ||
'controller' => 'Login', | ||
'action' => 'login' | ||
]); | ||
|
||
|
||
// Rota: GET /post/<id> | ||
Router::get('/post/:id',[ | ||
'controller' => 'Main', | ||
'action' => 'teste' | ||
])->params([ | ||
'id' => '\d+' | ||
]); | ||
|
||
// Rota: GET /post/<id> | ||
Router::get('/post/:nome/:id',[ | ||
'controller' => 'Main', | ||
'action' => 'teste' | ||
])->params([ | ||
'id' => '\d+', | ||
'nome' => '\w+' | ||
]); | ||
|
||
// Rota: GET /post/<algum-endereco> | ||
Router::get('/post/:slug',[ | ||
'controller' => 'Main', | ||
'action' => 'action' | ||
])->params([ | ||
'slug' => '[a-zA-Z0-9\-_]+' | ||
]); | ||
|
||
|
||
// Rota: GET /post/<DD-MM-YYYY>/<algum-endereco> | ||
Router::get('/post/:date/:slug', [ | ||
'controller' => 'Main', | ||
'action' => 'pdate' | ||
])->params([ | ||
'date' => '[0-9]{2}-[0-9]{2}-[0-9]{4}', | ||
'slug' => '[a-zA-Z0-9\-_]+' | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.