-
First, clone the repo and install the dependencies,
npm install
Keep in mind that we use
npm
for managing Node packages. If you try installing the dependencies withyarn
, it will generate ayarn-lock
file that will likely cause problems with the existingpackage-lock.json
.
This repository contains three exercises implemented in TypeScript using Node.js. Below are the details for each exercise and the necessary commands to run each one and their respective tests.
This exercise prints numbers from 1 to n, but for multiples of 3, it prints "Fizz" instead of the number and for multiples of 5, it prints "Buzz". For numbers that are multiples of both, it prints "FizzBuzz".
To run the FizzBuzz code, use the following command:
npm run fizz-buzz 15
This exercise finds the longest consecutive sequence in an array of numbers.
To run the Longest Consecutive Sequence exercise, use the following command:
npm run longest-consecutive "[100, 4, 200, 1, 3, 2]"
This exercise creates a small server using Express that allows user registration and validates input data using Yup. Users are stored in an in-memory array and a UUID is assigned to each registered user. A container using Awilix is created to use the dependency injector.
To run the Longest Consecutive Sequence exercise, use these command:
npm run start
The server will be available at http://localhost:3000.
You can make a request to the endpoint at http://localhost:3000/register with the POST method using the following body:
{
"email": "pepe2@gmail.com",
"name": "pepe"
}
You will receive a 201 Created response if the registration is successful, or a 409 Conflict response if the email has already been used.
Before submitting a patch, please make sure that the code is formatted executing this command:
npm run format
Testing is crucial for us and we strive for high coverage of our code.
We encourage you to write tests for every functionality you build and also update the existing ones if they need to.
Before running the test, install the needed dependencies:
npm install
Execute all tests with:
To run the tests we need to run this script
npm run test
Before pushing your changes, make sure you run the linter and prettier to ensure the code follows the rules, or the CI pipeline will throw an error and fail:
npm run lint
npm run format