Category ➡️ Software
Subcategory ➡️ JavaScript Backend Developer
Difficulty ➡️ Easy
In today's digital environment, the need for practical and straightforward tools for daily organization is more crucial than ever. A tech startup is looking to develop a user-friendly solution to this everyday challenge. They aim to create a backend API for a To-Do list application, harnessing the power of NodeJS to bring their vision to life.
A repository tree is provided below and should not be modified. Everything you need to develop the challenge is already included.
nuwe-backend-js-api1/
├── index.js
├── jest.config.js
├── Makefile
├── mongodb.js
├── package.json
├── package-lock.json
├── project
│ ├── routes
│ │ ├── common-routes.js
│ │ └── objectives
│ │ └── todo.js
│ └── schemas
│ ├── index.js
│ └── todo.js
├── README.md
├── results.json
└── tests
└── test_objectives.js
It is necessary to modify only the files proposed in the objectives.
URL | HTTP Verb | When | Return status | Return format |
---|---|---|---|---|
| GET | Always | 200 |
|
| GET | Found | 200 |
|
| GET | Not Found | 404 |
|
| POST | Data is valid | 201 |
|
| POST | Data is NOT valid | 400 |
|
| PUT | Id found | 200 |
|
| PUT | Id Not Found | 404 |
|
| DELETE | Id Found | 200 |
|
| DELETE | Id Not Found | 404 |
|
This challenge is about implementing a basic To-Do list backend API using Fastify and MongoDB. The API provides CRUD operations on Tasks, filtering based on differents patternsand data management.
Task 1: Implement the endpoints to create a Todo Task and extract them (GET and POST). It should follow the Endpoint Table you will find in the repository README.
Task 2: Implement the endpoints to update and delete Todo Tasks (UPDATE and DELETE). It should follow the Endpoint Table you will find in the repository README.
Task 3: Make sure to validate the input data from the user in each endpoint! There are multiple ways to do this, choose your own.
Task 4: Create 3 more endpoints implementing filtering
. The format specification for these endpoints are in the Objective 4: Filtering section of the README in the GitHub Repository.
Both endpoints supports filtering via query
. The filtering is available for the title
, categories
and done
fields.
The /todos/filter
endpoints extracts (GET) or deletes (DELETE) every single tasks that matches the filtering. If no filter is applied the endpoints does nothing.
The /todos/complete
endpoint allows to change the done
to true
to ALL the task that matches the filtering. If no filter is applied the endpoint should change nothing. The filtering in this endpoints only applies to title
and categories
fields.
URL | HTTP Verb | When | Return status | Return format |
---|---|---|---|---|
| GET | Always | 200 |
|
| DELETE | Always | 200 |
|
| PUT | Always | 200 |
|
In order to test the application you must have a MongoDB instance deployed locally. You can either create and install MongoDB on your test machine, use a cloud instance or use the mongodb.js
script.
To use the latter, first execute (and instantiate) the Mongodb server with the following command: node mongodb.js
Then execute the API web server by running make start
. Finally, to test the the objectives run make test
in the root folder.
⚠️ Attention: The tests DO NOT USE a test database. Make sure to remove the added data or any data before the start of the tests or some objectives won't pass properly.
Solve the proposed objectives.
Push the changes you have made.
Click on Submit Challenge.
Wait for the results.
The final score will be given according to whether or not the objectives have been met.
In this case, the challenge will be evaluated on 900 points which are distributed as follows:
Task 1: 225 points
Task 2: 225 points
Task 3: 225 points
Task 4: 225 points
In this case, as can be seen in /tests, the tests to be performed are given, so no I/O example will be given. Based on these tests, you should be able to complete all objectives.
It is not allowed to modify the basic functionality of the tests provided. Complementary tests may be added, but these will not be evaluated.
Timeline
01
Start the challenge & clone the repository
02
Solve the challenge & submit your solution
Next action: