Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c49dce8
Hello world
welligtonporto Jan 17, 2023
c561e15
Creating the gitignore file
welligtonporto Jan 17, 2023
131a421
Configuring routes and controllers
welligtonporto Jan 18, 2023
197d531
Creating the AppError util
welligtonporto Jan 18, 2023
8466b45
Init show method
welligtonporto Jan 18, 2023
5784a78
Continuing the conversion
welligtonporto Jan 18, 2023
0164471
Creating service
welligtonporto Jan 19, 2023
2891d46
Implementing tests
welligtonporto Jan 19, 2023
82b86d8
Init doc
welligtonporto Jan 19, 2023
01e6098
Continuing doc
welligtonporto Jan 19, 2023
ea64bfc
Continuing doc
welligtonporto Jan 19, 2023
f8fe93d
Continuing doc
welligtonporto Jan 19, 2023
14bb9a0
Continuing doc
welligtonporto Jan 19, 2023
0798564
Starting CI
welligtonporto Jan 19, 2023
d05ac08
Starting CI
welligtonporto Jan 19, 2023
1ae70bb
Defining diferent version to node on CI config
welligtonporto Jan 19, 2023
4b45daf
Removing watch parameter on test to deploy
welligtonporto Jan 19, 2023
3af4e22
Starting CI
welligtonporto Jan 20, 2023
f74eb46
Continuing\ CI
welligtonporto Jan 20, 2023
87203b0
Change to deploy
welligtonporto Jan 20, 2023
e223744
Finishing CI and updating doc
welligtonporto Jan 20, 2023
fea14c6
Finishing CI
welligtonporto Jan 20, 2023
1eacb83
Finishing doc
welligtonporto Jan 20, 2023
9168763
Updated the doc
welligtonporto Jan 23, 2023
98e4da0
Updated README.me
welligtonporto Jan 23, 2023
d188497
Commit to force deploy
welligtonporto Jan 23, 2023
4cf6aeb
Adjusting timeout tests
welligtonporto Jan 23, 2023
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
37 changes: 37 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "welligton-porto" ]
pull_request:
branches: [ "welligton-porto" ]

jobs:
build:

runs-on: self-hosted

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
- name: Stop pm2
run: pm2 stop nodedeploy
if: ${{failure()}}
- name: Start pm2
run: pm2 start ./src/server.js --name nodedeploy -f
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
62 changes: 30 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
# back-end-challenge
# personare-converter

> Desafio para os futuros back-end's do [@Personare](https://github.com/Personare)
An API that converts currencies.

## Introdução
## Getting started

A nossa Product Owner pensou em um produto fantástico para ser desenvolvido, porém é necessário realizar uma conversão de moedas para que tudo funcione perfeitamente e essa é a única feature que está faltando para entregarmos o projeto.
After cloning this repository follow the instructions to get started:

**Então, essa é a sua missão!**
```
cd back-end-challenge
git checkout welligton-porto
npm install
npm start
```

É isso mesmo, você deverá criar uma API que realize conversão de moedas.
## Running tests

E as especificações são:
```
npm run test
```

- A requisição deve receber a cotação via parâmetro
- A resposta deve conter o valor convertido e o símbolo da moeda
- Conversões:
- De Real para Dólar
- De Dólar para Real
- De Real para Euro
- De Euro para Real
## Endpoints

## Instruções
### GET /convert

1. Efetue o **fork** deste repositório e crie um branch com o seu nome. (ex: caue-alves).
2. Após finalizar o desafio, crie um **Pull Request**.
3. Aguarde algum contribuidor realizar o code review.
Currency conversion endpoint, which can be used to convert currencies.

## Pré-requisitos
Example: [http://167.172.146.132:3000/convert?from=USD&to=BRL&amount=1](http://167.172.146.132:3000/convert?from=USD&to=BRL&amount=1)

- Você pode usar a linguagem que preferir. (Preferência para PHP >= 5.6, Javascript ou Python)
- Orientado a objetos
- Test Driven Development
- A API deve retornar em formato de `json`
#### Parameters

## Diferenciais
* `from` (required): The three-letter currency code of the currency you would like to convert from.
* `to` (required): The three-letter currency code of the currency you would like to convert to.
* `amount` (required): The amount to be converted.

- S.O.L.I.D
- Boa documentação
- Não utilizar framework
- Utilização de DDD (Domain Driven Design)
- Implementar integração contínua
The currencies enabled on the API are:

## Dúvidas
| Code | Description |
| --- | ----------- |
| BRL | Brazilian real |
| USD | United States dollar |
| EUR | Euro |

Se surgir alguma dúvida, consulte as [perguntas feitas anteriormente](https://github.com/Personare/back-end-challenge/labels/question).
## CI/CD

Caso não encontre a sua resposta, sinta-se à vontade para [abrir uma issue](https://github.com/Personare/back-end-challenge/issues/new) =]
Continuos Integration and Continuos Delivery implemented using `GitHub Actions` and `Digital Ocean` as cloud (address: [http://167.172.146.132:3000/](http://167.172.146.132:3000/)).
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
bail: true,
coverageProvider: "v8",
testMatch: [
"<rootDir>/src/**/*.spec.js"
]
}
Loading