Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back-end Challenge - Finalizado #127

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
24 changes: 24 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Ignore Directory
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
"**/.hg/store/**": true,
"**/vendor/*/**": true,
},
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},

// PHP Standard
"phpSniffer.standard": "./phpcs.xml",
"phpSniffer.autoDetect": true,
"[php]": {
"editor.defaultFormatter": "wongjn.php-sniffer",
"editor.formatOnSave": true
},
}
57 changes: 27 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
# Back-end Challenge

Desafio para os futuros programadores back-end da Apiki.
Desafio back-end da Apiki.

## Introdução

Desenvolva uma **REST API** que faça conversão de moedas.
A **REST API** desenvolvida faz a conversão de moedas.

**Especifícações**:
## Instruções

* A URL da requisição deve seguir o seguinte formato:
* http://localhost:8000/exchange/{amount}/{from}/{to}/{rate}
* http://localhost:8000/exchange/10/BRL/USD/4.50
* A resposta deve seguir o seguinte formato:
1. Clonar o repositório: `git clone https://github.com/luispaiva/back-end-challenge`;
1. Troque de branch: `git checkout luis-paiva`;
2. Instalar as dependências utilizando composer: `composer install`;
3. Levantar servidor embutido do PHP: `php -S localhost:8000 index.php`;
4. Executar o lint do código: `composer lint`;
5. Executar os testes: `composer test`;

**Especificações**:

* Para realizar os testes com o servidor web embutido do PHP, esse é o formato da URL:
* http://localhost:8000/index.php/exchange/{amount}/{from}/{to}/{rate}
* http://localhost:8000/index.php/exchange/10/BRL/USD/4.50

<br>

*Obs.: Você deve usar `index.php/exchange/10/BRL/USD/4.50` em vez de `exchange/10/BRL/USD/4.50` na URL para garantir que o servidor web embutido do PHP chame o arquivo principal index.php.*
<br>

* Para realizar os testes em localhost, esse é o formato da URL:
* http://localhost/back-end-challenge/exchange/{amount}/{from}/{to}/{rate}
* http://localhost/back-end-challenge/exchange/10/BRL/USD/4.50

* A resposta segue o seguinte formato:
```json
{
"valorConvertido": 45,
"simboloMoeda": "$"
}
```
* Conversões:
* De Real para Dólar;
* De Dólar para Real;
* De Real para Euro;
* De Euro para Real;
* Serão executados testes automatizados para validação dos requisitos:
* Levantar servidor embutido do PHP: `php -S localhost:8000 index.php`;
* Executando testes: `composer test`;
* Executando lint: `composer lint`;

## Instruções

1. Efetue o fork deste repositório e crie um branch com o seu nome e sobrenome. (exemplo: fulano-dasilva)
2. Após finalizar o desafio, crie um Pull Request.
3. Aguarde algum contribuidor realizar o code review.

*Obs.: Não esqueça de executar o `composer test` e `composer lint` localmente.*

## Pré-requisitos

* PHP => 7.4
* Orientado a objetos

## Dúvidas

Em caso de dúvidas, crie uma issue.
* PHP => 7.4
2 changes: 1 addition & 1 deletion codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ suites:
modules:
enabled:
- REST:
url: http://localhost:8000/exchange
url: http://localhost:8000/index.php/exchange
depends: PhpBrowser

paths:
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"description": "Desafio para candidatos a back-end.",
"type": "project",
"require": {
"php": ">= 7.4"
"php": ">= 7.4",
"slim/slim": "3.*"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.4",
Expand Down
Loading