-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v0.0.1' into main
- Loading branch information
Showing
5 changed files
with
90 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#### Qual problema esse Pull Request aborda? | ||
|
||
[Descreva aqui o problema que esse Pull Request aborda de forma detalhada] | ||
|
||
#### Qual solução foi aplicada? | ||
|
||
[Descreva aqui a solução aplicada para resolução do problema citado acima] | ||
|
||
#### Card(s) do ClickUp | ||
|
||
[Cole aqui o link do card relacionado a esse problema] | ||
|
||
#### Grau de urgência | ||
|
||
- [X] **Baixo** [^1] | ||
- [ ] **Alto** [^2]: [Descreva aqui o motivo] | ||
|
||
#### Esse Pull Request deverá aguardar para ser mergeado? | ||
|
||
- [ ] **Sim** [^3]: [Descreva aqui o motivo] | ||
- [X] **Não** | ||
|
||
#### É necessário executar alguma etapa após o Pull Request ser mergeado? | ||
|
||
- [ ] **Sim**: [Descreva aqui o que deve ser feito] | ||
- [X] **Não** | ||
|
||
[^1]: Utilize grau de urgência **baixo** para alterações que **podem ser revisadas no mesmo dia**. | ||
[^2]: Utilize grau de urgência **alto** para alterações que **devem ser revisadas o quanto antes**. | ||
[^3]: Utilize a opção "**Sim**" para casos em que o merge das alterações trouxerem algum tipo de risco para a aplicação naquele momento. |
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 |
---|---|---|
@@ -1 +1 @@ | ||
./.idea | ||
.idea/ |
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,8 @@ | ||
<?php | ||
|
||
function buscaCep() | ||
{ | ||
echo json_encode([ | ||
'data' => 'do something', | ||
]); | ||
} |
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,5 @@ | ||
<?php | ||
|
||
header('Content-Type: application/json'); | ||
|
||
include 'routes.php'; |
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,46 @@ | ||
<?php | ||
|
||
include 'functions.php'; | ||
|
||
$uri = $_SERVER['REQUEST_URI']; | ||
$method = $_SERVER['REQUEST_METHOD']; | ||
|
||
$routes = [ | ||
'/cep' => [ | ||
'method' => 'GET', | ||
'action' => 'buscaCep', | ||
], | ||
]; | ||
|
||
function checkRouteExist($routes, $uri) | ||
{ | ||
if (!array_key_exists($uri, $routes)) { | ||
http_response_code(404); | ||
|
||
echo json_encode([ | ||
'data' => 'Not Found', | ||
]); | ||
|
||
die(); | ||
} | ||
} | ||
|
||
function checkMethod($routes, $uri, $method) | ||
{ | ||
$routeMethod = $routes[$uri]; | ||
|
||
if ($routeMethod['method'] !== $method) { | ||
http_response_code(405); | ||
|
||
echo json_encode([ | ||
'data' => 'Method Not Allowed', | ||
]); | ||
|
||
die(); | ||
} | ||
} | ||
|
||
checkRouteExist($routes, $uri); | ||
checkMethod($routes, $uri, $method); | ||
|
||
call_user_func($routes[$uri]['action']); |