Challenger of Certi Foundation
Na linguagem de sua preferência, crie um servidor HTTP que, para cada requisição GET, retorne um JSON cuja chave extenso seja a versão por extenso do número inteiro enviado no path. Os números podem estar no intervalo [-99999, 99999].
Exemplos:
λ curl http://localhost:3000/1
{ "extenso": "um" }
λ curl http://localhost:3000/-1042
{ "extenso": "menos mil e quarenta e dois" }
λ curl http://localhost:3000/94587
{ "extenso": "noventa e quatro mil e quinhentos e oitenta e sete" }
Firstly, you will need to install:
A step by step that will guide you on how to run the project on your computer.
Clone the project repository:
> git clone https://github.com/costadiogo/CertiFoundation
Go to the project directory:
> cd CertiFoundation
In your terminal type:
> yarn install
This command will install the dependencies and create the node_modules folder
After installing the dependencies we will start the server
In your terminal type:
> yarn start
This command will start the http server.
If everything has worked out so far in your terminal the following command will appear:
Test Main route from API
Test GET route
✓ Should return an message home route
Test GET route for return a number in full
Test GET/:id route
✓ Should return a number in full
> Server started at http://localhost:3000
Then open your browser and in the url type:
Your return should be:
{ "extenso": "um" }
In your terminal type:
> docker-compose up
This command will install the dependencies, run the tests and boot the server
If everything has worked out so far in your terminal the following command will appear:
Starting certifoundation_app_1 ... done
Attaching to certifoundation_app_1
app_1 | yarn run v1.22.5
app_1 | $ mocha --timeout 10000 && node server.js
app_1 |
app_1 |
app_1 | Test Main route from API
app_1 | Test GET route
app_1 | ✓ Should return an message home route
app_1 |
app_1 | Test GET route for return a number in full
app_1 | Test GET/:id route
app_1 | ✓ Should return a number in full
app_1 |
app_1 |
app_1 | 2 passing (34ms)
app_1 |
app_1 | Server started at http://localhost:3000
Then open your browser and in the url type:
Your return should be:
{ "extenso": "um" }
- Diogo Costa de Paula - LinkedIn
This project is licensed under the MIT License - see the LICENSE.md file for details