This challenge is about creating an API to manipulate a local JSON file (as if it were a database) through CRUD operations using Node.js' native functionalities.
Run the following command to start the project:
npm run dev
Now, with the server running locally using the port 3333, we are ready to make some requests.
You can test this challenge by make requests to this server. You can use Insomina or Postman β or whatever you prefer, really.
Here are the current available routes for this application:
- Create a task
- Method β POST
- Endpoint β http://localhost:3333/tasks
- Body request must contain both name and description parameters.
- Get list of tasks
- Method β GET
- Endpoint β http://localhost:3333/tasks
- You can also filter the results by name/description by querying it with the key search.
- Update a task
- Method β PUT
- Endpoint β http://localhost:3333/tasks/:id
- Body request must contain either the name or the description parameter β or both.
- Delete a task
- Method β DELETE
- Endpoint β http://localhost:3333/tasks/:id
- Mark task as complete
- Method β PATCH
- Endpoint β http://localhost:3333/tasks/:id/complete
To run this extra challenge, we need to make sure our server above is up and running.
We also need to install one dependency. To install it, run:
npm i
Execute the code the following command:
npm run import:csv
By running this command, we should be able to import the records within the CSV file located inside the src/files directory.